Why is EF returning a proxy class instead of the actual entity?

后端 未结 6 1491
时光取名叫无心
时光取名叫无心 2020-12-02 20:24

I\'m having trouble with entity framework returning Proxies when I want the actual entity class. The first time I run my code everything runs properly (no proxies), but eve

6条回答
  •  佛祖请我去吃肉
    2020-12-02 21:02

    To turn off proxy creation in Entity Framework 5 you can use the following,

    _dbContext.Configuration.ProxyCreationEnabled = false;
    

    Simply set this property once before using the context to pull data.

提交回复
热议问题