public EntityModelJsonConverter() { var derivedTypes = typeof(TEntity).Assembly .GetTypes() .Where(x => !x.IsAbstract && x.IsSubclassOf(typeof(TEntity))); _typeDictionary = derivedTypes.Append(typeof(TEntity)).ToDictionary(x => AliasHelper.GetEntityVariantAlias(x)); }
public static NavigationRequest NavigateToCreateNewEntity(string collectionAlias, IParent?parent, Type?entityVariant = null) { return(new NavigationRequest(collectionAlias) { ParentPath = parent?.GetParentPath(), IsEdit = true, IsNew = true, VariantAlias = entityVariant == null ? null : AliasHelper.GetEntityVariantAlias(entityVariant) }); }
public static EntityModel <T> Create <T>(T entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } return(new EntityModel <T> { Entity = entity, VariantAlias = AliasHelper.GetEntityVariantAlias(entity.GetType()) }); }
public EditContextModel(IEditContext <TEntity> editContext) { EntityModel = ApiBridge.EntityModel.Create(editContext.Entity); ParentPath = editContext.Parent?.GetParentPath()?.ToPathString(); var container = editContext.GetRelationContainer(); RelationContainer = new RelationContainerModel { Relations = container.Relations.Select(relation => { return(new RelationModel { Elements = relation.RelatedElements.Select(el => el.Id), PropertyName = relation.Property.PropertyName, VariantAlias = AliasHelper.GetEntityVariantAlias(relation.RelatedEntityType) }); }) }; }
public GlobalEntityVariantSetupResolver() { _types = typeof(IEntity).GetImplementingTypes().ToDictionary(x => AliasHelper.GetEntityVariantAlias(x)); }
public IResolvedSetup <IEntityVariantSetup> ResolveSetup(EntityVariantConfig config, ICollectionSetup?collection = default) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } if (config == default) { return(new ResolvedSetup <IEntityVariantSetup>(EntityVariantSetup.Undefined, true)); } else { return(new ResolvedSetup <IEntityVariantSetup>( new EntityVariantSetup(config.Name, config.Icon, config.Type, AliasHelper.GetEntityVariantAlias(config.Type)), true)); } }
public ParentQueryModel(IParent?parent, Type?variantType, IQuery query) : this(parent, query) { VariantAlias = variantType == null ? null : AliasHelper.GetEntityVariantAlias(variantType); }