Example #1
0
        public string?WhereSignature()
        {
            var includeColumns = IncludeColumns.HasItems() ? IncludeColumns.ToString(c => c.Name, "_") : null;

            if (string.IsNullOrEmpty(Where) && includeColumns == null)
            {
                return(null);
            }

            return("__" + StringHashEncoder.Codify(Where + includeColumns));
        }
        protected string ColumnSignature()
        {
            string columns        = Columns.ToString(c => c.Name, "_");
            var    includeColumns = IncludeColumns.HasItems() ? IncludeColumns.ToString(c => c.Name, "_") : null;

            if (string.IsNullOrEmpty(Where) && includeColumns == null)
            {
                return(columns);
            }

            return(columns + "__" + StringHashEncoder.Codify(Where + includeColumns));
        }
Example #3
0
        protected override void Prepare()
        {
            Schema  = DefaultWhereNull(Schema, () => "dbo");
            DbTable = Root !.DbTables.Where(x => x.Name == Name && x.Schema == Schema).SingleOrDefault();
            if (DbTable == null)
            {
                throw new CodeGenException($"Specified Schema.Table '{Schema}.{Name}' not found in database.");
            }

            Alias = DefaultWhereNull(Alias, () => new string(StringConversion.ToSentenceCase(Name) !.Split(' ').Select(x => x.Substring(0, 1).ToLower(System.Globalization.CultureInfo.InvariantCulture).ToCharArray()[0]).ToArray()));

            foreach (var c in DbTable.Columns)
            {
                if ((ExcludeColumns == null || !ExcludeColumns.Contains(c.Name)) && (IncludeColumns == null || IncludeColumns.Contains(c.Name)))
                {
                    DbColumns.Add(c);
                }
            }
        }