internal static object GetObjectKey(Context context, Instance instance) { return GetObjectKey(instance.EntityMap, instance.EntityObject, instance.IsPersisted); }
/// <summary>Advances the ObjectReader to the next record.</summary> /// <returns>True if there are more objects; otherwise, false.</returns> public bool Read() { bool read; if (this.firstRead) { this.firstRead = false; read = this.hasObjects; } else { read = this.data.Read(); } if (read) { if (this.firstLevel) Internals.LocalStore.Reset(this.objectType); Internals.EntityMap entity = this.context.Mappings[this.ObjectType]; Type instanceType = this.ObjectType; if (entity.SubTypes.Count > 0) { string typeValue = this.data[entity.TypeField].ToString(); if (entity.SubTypes.ContainsKey(typeValue)) { instanceType = Internals.EntityMap.GetType((string)entity.SubTypes[typeValue]); } } this.current = Activator.CreateInstance(instanceType, true); Internals.Instance instance = new Internals.Instance(this.context, this.current, this.data); if (this.hasEvents) { ((IObjectNotification) this.current).OnMaterialized(this.data); } if (this.context.Mappings[objectType.ToString()].AutoTrack) { this.context.StartTracking(instance); } } else { this.current = null; this.Close(); } return read; }
internal PersistOptions(Instance instance, PersistDepth depth) { this.instance = instance; this.depth = depth; this.entityObject = instance.EntityObject; }