Beispiel #1
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);
                }
            }
        }