Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of this class.
 /// Used internally to initialize the structure on materialization.
 /// </summary>
 /// <param name="owner">The owner of this instance.</param>
 /// <param name="field">The owner field that describes this instance.</param>
 protected Structure(Persistent owner, FieldInfo field)
     : base(owner.Session)
 {
     try {
         typeInfo = GetTypeInfo();
         Owner    = owner;
         Field    = field;
         if (owner == null || field == null)
         {
             tuple = typeInfo.TuplePrototype.Clone();
         }
         else
         {
             tuple = field.ExtractValue(
                 new ReferencedTuple(() => Owner.Tuple));
         }
         SystemBeforeInitialize(true);
         InitializeOnMaterialize();
     }
     catch (Exception error) {
         InitializationErrorOnMaterialize(error);
         throw;
     }
 }
Ejemplo n.º 2
0
 internal static void ExecuteOnValidate(Persistent target)
 {
     target.OnValidate();
 }
Ejemplo n.º 3
0
 private static Key GetOwnerKey(Persistent owner)
 {
     return(owner is IFieldValueAdapter asFieldValueAdapter
 ? GetOwnerKey(asFieldValueAdapter.Owner)
 : ((Entity)owner).Key);
 }