getting Entity Framework raw query to respect attributes

前端 未结 1 1271
北海茫月
北海茫月 2020-12-19 05:17

I\'m using EF4, code first. As such, my model classes have a mix of public properties, some virtual properties (for lazy loaded data from other tables) and some properties t

相关标签:
1条回答
  • 2020-12-19 05:21

    If you execute dbContext.Database.SqlQuery EF will never use mapping. It will use just simple match of property names and columns in result set. Try to use dbSet.SqlQuery instead. It should reflect mapping because it can load data as attached entities.

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