Linq To SQL Attach/Refresh Entity Object

前端 未结 2 579
梦如初夏
梦如初夏 2021-01-02 03:56

In Linq To Sql, when updating one of my entities, Faculty, I am creating a new instance of the Faculty object, then initializing some of the properties with values

相关标签:
2条回答
  • 2021-01-02 04:27

    Did you try

    context.Refresh(RefreshMode.OverwriteCurrentValues, faculty);

    after submit changes where context is your linq2sql datacontext and faculty is the entity you want to refresh?

    0 讨论(0)
  • 2021-01-02 04:35

    What about retrieving the object from the database, then changing the appropriate values, then submitting the update?

    0 讨论(0)
提交回复
热议问题