Public Override Int Savechanges (saveoptions options)
{
Foreach (Entityobject entity In This . Objectstatemanager. getobjectstateentries (entitystate. Added | entitystate. Modified). Select (Entry => entry. entity ))
{
// If (entity = NULL | entity is user) continue;
String STR = Typeof ( String ). Name;
VaRProps = entity. GetType (). getproperties ();
VaR Properties = From P In Entity. GetType (). getproperties ()
Where
P. propertytype. Name = STR &&
P. isdefined ( Typeof (Edmscalarpropertyattribute ), False )&&
P. isdefined ( Typeof (Datamemberattribute ), False )
Select P;
Foreach ( VaR Item In Properties)
{
String Value = ( String ) Item. getvalue (entity, Null );
If (Value! = Null & Value. Trim (). Length = 0 )
Entity. GetType (). getfield ( " _ " + Item. Name, system. reflection. bindingflags. nonpublic | system. reflection. bindingflags. instance). setvalue (entity, Null );
}
}
Return Base . Savechanges (options );
}