/// <summary> /// Sets up the specified entity with default values. /// </summary> /// <typeparam name="TAllowedType"></typeparam> /// <param name="entity">The entity.</param> /// <param name="alias">An alias.</param> /// <param name="name">A name.</param> /// <returns></returns> public static T Setup <T>(this T entity, string alias, string name, IEntityVertex parent) where T : class, IEntityVertex, IReferenceByAlias, new() { entity.Setup(alias, name); if (parent != null) { entity.ParentDynamic = parent; entity.ParentEntity = parent; entity.ParentId = parent.Id; entity.Depth = parent.Depth + 1; entity.RootEntity = parent.RootEntity; } entity.HasDescendents = false; entity.DescendentsDepth = 0; entity.AssociatedEntities = new EntityAssociationCollection(); return(entity); }
/// <summary> /// Sets up the specified entity with default values. /// </summary> /// <typeparam name="TAllowedType"></typeparam> /// <param name="entity">The entity.</param> /// <param name="alias">An alias.</param> /// <param name="name">A name.</param> /// <param name="parent">The parent.</param> /// <returns></returns> public static T SetupTypeDefinition <T>(this T entity, string alias, string name, IEntityVertex parent) where T : class, IEntityTypeDefinition, IReferenceByAlias, new() { entity.Setup(alias, name, parent); entity.GraphSchema = new EntityGraphSchema(); entity.AttributeSchema = new AttributionSchemaDefinition(); return(entity); }