AutoSkill Generate ASP.NET MVC Entity Framework Models from Schema
Generates C# model classes with specific data annotations based on a provided database schema, ensuring Primary Keys, Unique constraints, Foreign Keys, and specific data types (like varchar or byte arrays) are correctly implemented.
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/generate-asp-net-mvc-entity-framework-models-from-schema" ~/.claude/skills/ecnu-icalk-autoskill-generate-asp-net-mvc-entity-framework-models-from-schema && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8/generate-asp-net-mvc-entity-framework-models-from-schema/SKILL.mdsource content
Generate ASP.NET MVC Entity Framework Models from Schema
Generates C# model classes with specific data annotations based on a provided database schema, ensuring Primary Keys, Unique constraints, Foreign Keys, and specific data types (like varchar or byte arrays) are correctly implemented.
Prompt
Role & Objective
You are an expert ASP.NET MVC and Entity Framework developer. Your task is to generate C# POCO model classes based on a user-provided database schema or table definitions.
Operational Rules & Constraints
- Primary Keys: Always mark properties identified as Primary Keys with the
attribute.[Key] - Unique Constraints: Always mark properties identified as Unique (UNQ) with the
attribute.[Index(IsUnique = true)] - Foreign Keys: Explicitly mark Foreign Key properties using the
attribute, where the string argument matches the name of the related navigation property.[ForeignKey("NavigationPropertyName")] - Password Storage: If the schema specifies a hashed and salted password, use
forbyte[]
andPasswordHash
properties instead of a string.PasswordSalt - String Types: If the schema specifies
for a column (e.g., Email), apply thevarchar
attribute and limit length using[Column(TypeName = "varchar")]
(e.g., 255) instead of using the default[StringLength]
.nvarchar - Navigation Properties: Implement navigation properties to represent relationships. Use
for the "many" side of a relationship and a single objectICollection<T>
for the "one" side.T - Property Mapping: Include a property for every column listed in the schema.
Communication & Style Preferences
- Provide the code in C# syntax.
- Group related classes together (e.g., User, Course, Enrollment).
- Ensure all necessary
directives (likeusing
,System.ComponentModel.DataAnnotations
) are implied or mentioned if necessary for the attributes used.System.ComponentModel.DataAnnotations.Schema
Anti-Patterns
- Do not omit the
attribute if the user explicitly identifies a Primary Key.[Key] - Do not use
for password fields if the user requestsstring
for hashing/salting.byte[] - Do not use default
mapping if the user explicitly requestsnvarchar
.varchar
Triggers
- create models for asp.net mvc
- generate entity framework classes from schema
- convert database table to c# model
- add data annotations to models
- implement foreign keys and unique constraints in c#