Can a collection of invalid objects be saved through the DataPortal_Update? Right now, it seems to block that save; however, I want the save to occur because the objects are being edited and the user has the option to come back to them and fix 'em later.
I think, in part, this is why warnings were introduced - though there's a semantic difference, I suppose.
The least intrusive way I can think of doing this would be to perhaps provide a field in the business object for _suppressInvalidity and then override IsValid to accomodate this. Then, you could perhaps provide a method for SaveWithErrors or something like that which would set the flag, do a base.Save(), and then change the _suppressInvalidity back to false.
I'm sure others have had a need for it and have solved it with more rigor, though - so I'm sure there are potentially better ideas than that.
I found I could override the Save in the base class and exclude the check for IsValid.
For me, the check for IsValid comes in to decide which table to save the records to so that I can have a "working" table and a "live" table for records. This way the valid collection can save itself to the proper location and the invalid collection saves itself to the other location.
I override it like this:
public override AgencyImports Save()
{
AgencyImports result; if (IsDirty)result = (
AgencyImports)DataPortal.Update(this); elseresult = (
AgencyImports)this;OnSaved(result);
return result;}
Copyright (c) Marimer LLC