Is there an option to make Entity Framework revert empty strings to null?

后端 未结 8 893
时光说笑
时光说笑 2021-02-06 09:30

I am using an ADO.NET Entity-Framework ObjectContext to access my data store.

I want the if values are set with empty strings, they should automatically become null.

8条回答
  •  盖世英雄少女心
    2021-02-06 10:04

    Not that I'm aware of.

    You could possibly write a class that inherited from ObjectContext and override SaveChanges() to do that and use that instead of ObjectContext in your x.objectlayer.cs / x.designer.cs

提交回复
热议问题