开发者

Should i use structuremap to handle lifecycle of my linq datacontext?

开发者 https://www.devze.com 2023-03-11 23:24 出处:网络
Is it ok to use SM to handle my linq datacontext lifetime or just create datacontext instance inside repository constructor? I heard from you will have memory leak problem in SM if you let it handle t

Is it ok to use SM to handle my linq datacontext lifetime or just create datacontext instance inside repository constructor? I heard from you will have memory leak problem in SM if you let it handle the datacontext. As commented by Rob Connery in this thread. See the comment below. Strange behaviour with StructureMap / ASP.MVC / Visual Studio / LinqToSql

I'm using SM and asp.net mvc . It seems that im getting my memory incre开发者_Go百科ased eventually even context is disposed.


I let Unity handle the lifetime of my LinqToSql context on and MVC app and have never had any problems.

In general, I don't see why an IoC container would have problems managing the lifetime of its objects. If StructureMap does (as mentioned in the thread you reference), you probably shouldn't do it then. :)

I guess your options are to either use a different framework, or let the Repository instantiate its context.

0

精彩评论

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

关注公众号