How can I reload a table from storage (discard changes)

Mar 15, 2011 at 12:08 AM
Edited Mar 15, 2011 at 12:15 AM

I have a scenario where I have multiple tables that can have changes that have not been persisted yet, and  I need a way to discard the changes for a single table.   I don't want to open the entire db again because some changes might end up being needed.

 

I was thinking something like this might work, but I was hoping that I am just missing in the current API that already supports it.

 

public void DiscardChanges<T>()

{

    _loadedTables[typeof(T)] = false;

}

 

Mar 15, 2011 at 1:56 AM

Nope, unfortunately there is nothing.  Your code will work if you use lazy loading.  I will work on this this week and will publish a build once this is completed, hopefully later this week.

Thanks.

Sergey

Mar 15, 2011 at 2:29 AM

I just posted the new release with CancelChanges added.  Please give it a try.  I marked it as alpha release for now.  Please let me know if it works OK for you.

Thanks.

Mar 15, 2011 at 3:52 AM

Thats working great.

Thanks

Mar 16, 2011 at 6:54 AM
Edited Mar 16, 2011 at 7:00 AM

 

Mar 16, 2011 at 11:40 AM

Could it be you have not saved the table yet, so there is not file there yet?  There is nothing to reverse if nothing was saved...

Mar 16, 2011 at 7:07 PM
Edited Mar 17, 2011 at 1:20 AM

Yes, it was somthing similar to what you said, I was trying to delete from the wrong database so it wasnt finding the file.   Everthing is working good now.

Thanks for your help.