Exemplo n.º 1
0
        public OperationHelp(OperationSymbol operationSymbol, CultureInfo ci, OperationHelpEntity entity)
        {
            this.OperationSymbol = operationSymbol;
            this.Culture         = ci;

            this.Info = HelpGenerator.GetOperationHelp(operationSymbol);

            if (entity != null)
            {
                HasEntity = true;

                UserDescription = entity.Description;
            }

            Entity = new Lazy <OperationHelpEntity>(() => HelpLogic.GlobalContext(() =>
            {
                if (entity == null)
                {
                    entity = new OperationHelpEntity
                    {
                        Culture   = this.Culture.ToCultureInfoEntity(),
                        Operation = this.OperationSymbol,
                    }
                }
                ;

                return(entity);
            }));
        }
Exemplo n.º 2
0
 public OperationHelp(OperationSymbol operationSymbol, Type type, string?userDescription)
 {
     this.OperationSymbol = operationSymbol;
     this.Type            = type;
     this.Info            = HelpGenerator.GetOperationHelp(type, operationSymbol);
     this.UserDescription = userDescription;
 }
Exemplo n.º 3
0
        public OperationHelp(OperationSymbol operationSymbol, Type type)
        {
            this.OperationSymbol = operationSymbol;
            this.Type            = type;

            this.Info = HelpGenerator.GetOperationHelp(type, operationSymbol);
        }
Exemplo n.º 4
0
        public PropertyHelp(PropertyRoute propertyRoute)
        {
            if (propertyRoute.PropertyRouteType != PropertyRouteType.FieldOrProperty)
            {
                throw new ArgumentException("propertyRoute should be of type Property");
            }

            this.PropertyRoute = propertyRoute;
            this.Info          = HelpGenerator.GetPropertyHelp(propertyRoute);
        }
Exemplo n.º 5
0
        public QueryHelp(object queryName, CultureInfo ci, QueryHelpEntity?entity)
        {
            QueryName = queryName;
            Culture   = ci;
            Info      = HelpGenerator.GetQueryHelp(QueryLogic.Queries.GetQuery(queryName).Core.Value);
            var cols = entity?.Columns.ToDictionary(a => a.ColumnName, a => a.Description);

            Columns = QueryLogic.Queries.GetQuery(queryName).Core.Value.StaticColumns.ToDictionary(
                cf => cf.Name,
                cf => new QueryColumnHelp(cf, cf.DisplayName(), HelpGenerator.GetQueryColumnHelp(cf), cols?.TryGetCN(cf.Name)));

            DBEntity        = entity;
            UserDescription = entity?.Description;
        }
Exemplo n.º 6
0
        public QueryHelp(object queryName, CultureInfo ci, QueryHelpEntity entity)
        {
            QueryName = queryName;
            Culture   = ci;
            Info      = HelpGenerator.GetQueryHelp(DynamicQueryManager.Current.GetQuery(queryName).Core.Value);
            Columns   = DynamicQueryManager.Current.GetQuery(queryName).Core.Value.StaticColumns.ToDictionary(
                cf => cf.Name,
                cf => new QueryColumnHelp(cf, cf.DisplayName(), HelpGenerator.GetQueryColumnHelp(cf)));

            if (entity != null)
            {
                HasEntity = true;

                UserDescription = entity.Description;

                foreach (var tranColumn in entity.Columns)
                {
                    Columns.GetOrThrow(tranColumn.ColumnName).UserDescription = tranColumn.Description;
                }
            }

            Entity = new Lazy <QueryHelpEntity>(() => HelpLogic.GlobalContext(() =>
            {
                if (entity == null)
                {
                    entity = new QueryHelpEntity
                    {
                        Culture = this.Culture.ToCultureInfoEntity(),
                        Query   = QueryLogic.GetQueryEntity(this.QueryName),
                    }
                }
                ;

                entity.Columns.AddRange(
                    DynamicQueryManager.Current.GetQuery(this.QueryName).Core.Value.StaticColumns.Select(a => a.Name)
                    .Except(entity.Columns.Select(a => a.ColumnName))
                    .Select(pr => new QueryColumnHelpEmbedded
                {
                    ColumnName  = pr,
                    Description = null,
                }));

                return(entity);
            }));
        }
Exemplo n.º 7
0
        public TypeHelp(Type type, CultureInfo culture, TypeHelpEntity?entity)
        {
            Type    = type;
            Culture = culture;
            Info    = HelpGenerator.GetEntityHelp(type);

            var props = DBEntity?.Properties.ToDictionaryEx(a => a.Property.ToPropertyRoute(), a => a.Info);
            var opers = DBEntity?.Operations.ToDictionaryEx(a => a.Operation, a => a.Info);

            Properties = PropertyRoute.GenerateRoutes(type)
                         .ToDictionary(pp => pp, pp => new PropertyHelp(pp, props?.TryGetC(pp)));

            Operations = OperationLogic.TypeOperations(type)
                         .ToDictionary(op => op.OperationSymbol, op => new OperationHelp(op.OperationSymbol, type, opers?.TryGetC(op.OperationSymbol)));


            var allQueries = HelpLogic.CachedQueriesHelp();

            Queries = HelpLogic.TypeToQuery.Value.TryGetC(this.Type).EmptyIfNull().Select(a => allQueries.GetOrThrow(a)).ToDictionary(qh => qh.QueryName);

            DBEntity = entity;
        }
Exemplo n.º 8
0
        public EntityHelp(Type type, CultureInfo culture, EntityHelpEntity entity)
        {
            Type    = type;
            Culture = culture;
            Info    = HelpGenerator.GetEntityHelp(type);

            Properties = PropertyRoute.GenerateRoutes(type)
                         .ToDictionary(
                pp => pp,
                pp => new PropertyHelp(pp, HelpGenerator.GetPropertyHelp(pp)));


            var allOperations = HelpLogic.CachedOperationsHelp();

            Operations = OperationLogic.GetAllOperationInfos(type).Select(oi => allOperations.GetOrThrow(oi.OperationSymbol)).ToDictionary(a => a.OperationSymbol);

            var allQueries = HelpLogic.CachedQueriesHelp();

            Queries = HelpLogic.TypeToQuery.Value.TryGetC(this.Type).EmptyIfNull().Select(a => allQueries.GetOrThrow(a)).ToDictionary(qh => qh.QueryName);

            if (entity != null)
            {
                HasEntity = true;

                Description = entity.Description;

                foreach (var tranProp in entity.Properties)
                {
                    Properties.GetOrThrow(tranProp.Property.ToPropertyRoute()).UserDescription = tranProp.Description;
                }

                foreach (var transOper in entity.Operations)
                {
                    Operations.GetOrThrow(transOper.Operation).UserDescription = transOper.Description;
                }
            }

            Entity = new Lazy <EntityHelpEntity>(() => HelpLogic.GlobalContext(() =>
            {
                if (entity == null)
                {
                    entity = new EntityHelpEntity
                    {
                        Culture = this.Culture.ToCultureInfoEntity(),
                        Type    = this.Type.ToTypeEntity(),
                    }
                }
                ;

                entity.Properties.AddRange(
                    PropertyRouteLogic.RetrieveOrGenerateProperties(this.Type.ToTypeEntity())
                    .Except(entity.Properties.Select(a => a.Property))
                    .Select(pr => new PropertyRouteHelpEmbedded
                {
                    Property    = pr,
                    Description = null,
                }));

                entity.Operations.AddRange(this.Operations.Values.Select(o => o.Entity.Value).ToList());

                entity.Queries.AddRange(this.Queries.Values.Select(a => a.Entity.Value).ToList());

                return(entity);
            }));
        }