开发者

Using EntityDataSource in "Tracing and Caching for Entity Framework"

I am using Tracing and Caching for Entity Framework in my asp.net 4 application. It works great when I work on my entities manually, but in master-detail pages that have a gridview and an entitydatasource, I cannot make entitydatasource use the global cache because I have no control over creating objectcontext and entitydatasource does all the work by itself.

My question is: is there a way to customize entitydatasource for initializ开发者_如何学Cing the object context and things like that and if not how can i use and objectdatasource with entity faramework.


Yes there is a way. EntityDataSource offers event ContextCreating. If you handle this event you will be able to initialize context yourselves and pass it to data source via event's arguments.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜