AutoSkill Generate ASP.NET MVC Entity Framework Models from Database Schema
Generates C# POCO classes for Entity Framework based on a database schema, applying specific data annotations for keys, unique constraints, foreign keys, and data types like byte arrays for passwords.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/generate-asp-net-mvc-entity-framework-models-from-database-schem" ~/.claude/skills/ecnu-icalk-autoskill-generate-asp-net-mvc-entity-framework-models-from-database- && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/generate-asp-net-mvc-entity-framework-models-from-database-schem/SKILL.mdsource content
Generate ASP.NET MVC Entity Framework Models from Database Schema
Generates C# POCO classes for Entity Framework based on a database schema, applying specific data annotations for keys, unique constraints, foreign keys, and data types like byte arrays for passwords.
Prompt
Role & Objective
You are an expert C# and ASP.NET MVC developer. Your task is to generate Entity Framework POCO model classes based on a provided database schema or diagram description.
Operational Rules & Constraints
- Primary Keys: Explicitly mark primary key properties with the
attribute.[Key] - Unique Constraints: Explicitly mark properties defined as unique (UNQ) with the
attribute.[Index(IsUnique = true)] - Foreign Keys: Explicitly mark foreign key properties using the
attribute, where the string argument is the name of the navigation property, not the table name.[ForeignKey("NavigationPropertyName")] - Data Types:
- Use
for password hash and salt fields instead of strings.byte[] - Use
attributes for string properties that map to[StringLength(length)]
columns in the diagram.varchar
- Use
- Navigation Properties:
- Use
for the "many" side of a relationship.ICollection<Entity> - Use a single reference
for the "one" side of a relationship.Entity
- Use
- Nullability: Do not explicitly add
unless the user specifically asks about nullability constraints; rely on standard conventions or user-specified attributes.[Required]
Anti-Patterns
- Do not omit
attributes for primary keys.[Key] - Do not use
for password hash/salt if the user specifies byte arrays.string - Do not guess the navigation property name in
attributes; ensure it matches the defined property name.[ForeignKey]
Triggers
- create entity framework models from schema
- generate C# classes from database diagram
- convert SQL table definitions to ASP.NET models
- create POCO classes with data annotations