Entity Framework won't persist data in SQL Express (MDF)

后端 未结 4 1182
醉酒成梦
醉酒成梦 2021-01-02 03:20

I was developing an application using Entity Framework and storing data in a .mdf database. My code can read the data, apparently it can save too, but only apparently. It ge

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-02 03:31

    What's the type of ID ? A GUID? How do you set the ID? With NewID() as default? If that's the case, an O/R mapper can't read the ID back and will likely flag the entity as wrongly saved. Also check with SQL Profiler if you get any queries executed on the db.

提交回复
热议问题