开发者

Can you make Linq-to-SQL get rid of lazy loaded properties after they are saved?

I have an application that uses Linq-to-SQL and stores very large objects. When it's processing and saving these new objects, I want to keep them in memory, but after it saves I want to get rid of the lazy loaded property (the one that is taking up all the memory).

Is there any way to do this without just getting rid of the object and reloading it from the database? I know I can do that, but I'm 开发者_开发知识库hoping for a cleaner way of just telling it "relase this property on save"...

Thoughts?


I believe you can do this by detaching the entity from the database context. You can do this as follows:

    public virtual void Detach()
    {
        PropertyChanging = null;
        PropertyChanged = null;
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜