Houshang.Karami
Houshang.Karami

Reputation: 291

Entity Framework doesn't work with Nullable columns

I have problem with Entity Framework.

I have a table Victor with 3 nullable columns. When the wizard is finished, I can't see the nullable columns inside the CreateVictor() method, this method automatically is being generated by wizard not me.

After 4 hours I couldn't find any solution. This happens just for nullable column.

Upvotes: 1

Views: 224

Answers (1)

Mac
Mac

Reputation: 2342

This is a 'feature' rather than a bug. The idea is that only the non-null columns are required to create a 'Victor'. So they are the only columns included in the CreateVictor() method.

If you want to set the other properties, you can do this with the object returned by CreateVictor().

var victor = Victor.CreateVictor(...);
victor.Name = "name";

Upvotes: 8

Related Questions