jeudi 24 septembre 2015

Entity framework know "not null" by reflection

I need to know if my column in my database is set as "not null" or "nullable" by reflection.

I try with with this line :

bool canBeNull = !col.PropertyType.IsValueType || (Nullable.GetUnderlyingType(col.PropertyType) != null);

But my boolean is always true. Also when column are set as "not null".

What is the best way for know this information?

Thx





Aucun commentaire:

Enregistrer un commentaire