views:

29

answers:

1

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?

A: 

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;
    }
Randy Minder