예제 #1
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;
        }
예제 #2
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);
            }));
        }