Пример #1
0
        private INakedObject RecreateObject(ObjectData data)
        {
            INakedObject nakedObject = PersistorUtils.RecreateInstance(data.Oid, SpecFor(data));

            InitObject(nakedObject, data);
            return(nakedObject);
        }
Пример #2
0
        private INakedObject CreateAndInitNakedObject(ObjectData instanceData)
        {
            Log.DebugFormat("Instance data {0}", instanceData);

            IOid oid = instanceData.Oid;
            INakedObjectSpecification spec = SpecFor(instanceData);
            INakedObject instance          = PersistorUtils.RecreateInstance(oid, spec);

            InitObject(instance, instanceData);
            return(instance);
        }
Пример #3
0
        private static INakedObject SetupReference(INakedObjectAssociation field, IOid referenceOid, Data fieldData, INakedObject nakedObject)
        {
            Log.DebugFormat("Setting up field {0} with {1}", field, referenceOid);
            INakedObject reference = null;

            if (fieldData == null)
            {
                INakedObject adapter = PersistorUtils.RecreateInstance(referenceOid, field.Specification);
                if (!adapter.ResolveState.IsDestroyed())
                {
                    nakedObject.ResolveState.Handle(Events.DestroyEvent);
                }
                ((IOneToOneAssociation)field).InitAssociation(nakedObject, adapter);

                Log.Warn("No data found for " + referenceOid + " so field '" + field.Name + "' not set in object '" + nakedObject + "'");
            }
            else
            {
                reference = PersistorUtils.RecreateInstance(referenceOid, SpecFor(fieldData));
                ((IOneToOneAssociation)field).InitAssociation(nakedObject, reference);
            }
            return(reference);
        }