taji01
taji01

Reputation: 2615

Entity Framework is auto-naming column incorrectly

I'm using C# / Entity Framework (EF). I'm using the database first approach to generate the tables and stored procedures.

When I generate the stored procedure, my parameter name p30CharacterDescription is named incorrectly by EF. It should be 30CharacterDescription without the (p) in the front.

My database table has the column name written like this: 30CharacterDescription. I'm not sure why EF is adding that extra p to the parameter name.

Why is EF adding that extra p to the front of the parameter and how can I solve this issue? Can I tell EF to name the parameter without the p in front?

mo

Upvotes: 1

Views: 115

Answers (1)

Johnathan Barclay
Johnathan Barclay

Reputation: 20354

Property names must start with either a letter or underscore, so the prefix is a necessity.

It won't affect how your code functions, as it will still be mapped to the correct database column.

Upvotes: 3

Related Questions