/// <summary> /// Sets up the entity from schema. /// </summary> /// <param name="entity"></param> public static void SetupFromSchema(this TypedEntity entity) { if (entity.EntitySchema == null) { throw new InvalidOperationException( "Cannot setup this TypedEntity from its EntitySchema since the EntitySchema property is null"); } entity.SetupFromSchema(entity.EntitySchema); }
public static void SetupFromEntity(this TypedEntity entity, TypedEntity other) { entity.SetupFromSchema(other.EntitySchema); entity.Id = other.Id; entity.UtcCreated = other.UtcCreated; entity.UtcModified = other.UtcModified; entity.UtcStatusChanged = other.UtcStatusChanged; entity.Attributes.Reset(other.Attributes); entity.RelationProxies.LazyLoadDelegate = other.RelationProxies.LazyLoadDelegate; }
/// <summary> /// Sets up the entity from schema. /// </summary> /// <typeparam name="TSchema">The type of the schema.</typeparam> /// <param name="entity">The entity.</param> public static void SetupFromSchema <TSchema>(this TypedEntity entity) where TSchema : EntitySchema, new() { entity.SetupFromSchema(new TSchema()); }