public void UpdateSourceAssigned(MarshalObjectList mol) { IObjectManager om = Context.ObjectManager; IMarshalingTransformer transformer = new MarshalingTransformer(Context); IClassMap classMap; MarshalProperty mp; object obj; object newValue; foreach (MarshalObject mo in mol.Objects) { if (mo.TempId.Length > 0) { obj = GetInsertedObjectWithTemporaryIdentity(mo.TempId); if (obj != null) { classMap = Context.DomainMap.MustGetClassMap(obj.GetType()); foreach (IPropertyMap propertyMap in classMap.GetAllPropertyMaps()) { if (propertyMap.GetIsAssignedBySource()) { mp = mo.GetProperty(propertyMap.Name); if (mp != null) { newValue = transformer.ToPropertyValue(obj, mp.Value, mp, propertyMap); om.SetPropertyValue(obj, propertyMap.Name, newValue); om.SetOriginalPropertyValue(obj, propertyMap.Name, newValue); om.SetNullValueStatus(obj, propertyMap.Name, false); } } } Context.IdentityMap.UpdateIdentity(obj, mo.TempId); } } else { classMap = Context.DomainMap.MustGetClassMap(mo.Type); if (classMap.HasAssignedBySource() ) { obj = GetObjectByMarshalObject(transformer, mo, classMap); foreach (IPropertyMap propertyMap in classMap.GetAllPropertyMaps()) { if (propertyMap.GetIsAssignedBySource()) { mp = mo.GetProperty(propertyMap.Name); if (mp != null) { newValue = transformer.ToPropertyValue(obj, mp.Value, mp, propertyMap); om.SetPropertyValue(obj, propertyMap.Name, newValue); om.SetOriginalPropertyValue(obj, propertyMap.Name, newValue); om.SetNullValueStatus(obj, propertyMap.Name, false); } } } } } } }
public virtual MarshalObjectList FromObjectList(IList sourceObjects) { MarshalObjectList mol = new MarshalObjectList(); foreach (object obj in sourceObjects) { MarshalObject mo = FromObject(obj); mol.Objects.Add(mo); } return(mol); }
//Two pass operation - first deserialise all objects, the set up relationships public virtual IList ToObjectList(MarshalObjectList marshalObjectList, RefreshBehaviorType refreshBehavior, IList listToFill) { foreach (MarshalObject mo in marshalObjectList.Objects) { GetObjectListObject(mo, 1, refreshBehavior); } foreach (MarshalObject mo in marshalObjectList.Objects) { object obj = GetObjectListObject(mo, 2, refreshBehavior); listToFill.Add(obj); } return(listToFill); }
//Two pass operation - first deserialise all objects, the set up relationships public virtual IList ToObjectList(MarshalObjectList marshalObjectList, RefreshBehaviorType refreshBehavior, IList listToFill) { foreach (MarshalObject mo in marshalObjectList.Objects) { GetObjectListObject(mo, 1, refreshBehavior); } foreach (MarshalObject mo in marshalObjectList.Objects) { object obj = GetObjectListObject(mo, 2, refreshBehavior); listToFill.Add(obj); } return listToFill; }
public virtual MarshalObjectList FromObjectList(IList sourceObjects) { MarshalObjectList mol = new MarshalObjectList(); foreach (object obj in sourceObjects) { MarshalObject mo = FromObject(obj); mol.Objects.Add(mo); } return mol; }