示例#1
0
        public MySmo.UserDefinedTableType GetUserDefinedTableType(Smo.UserDefinedTableType smo_tt, MySmo.Database parent = null)
        {
            #region implement

            SetDataLimit();

            var mysmo_tt = new MySmo.UserDefinedTableType();
            mysmo_tt.ParentDatabase     = parent;
            mysmo_tt.Name               = smo_tt.Name;
            mysmo_tt.Schema             = smo_tt.Schema;
            mysmo_tt.CreateTime         = smo_tt.CreateDate;
            mysmo_tt.Owner              = smo_tt.Owner;
            mysmo_tt.ExtendedProperties = GetExtendProperties(mysmo_tt, smo_tt.ExtendedProperties);
            var s = "";
            if (mysmo_tt.ExtendedProperties.TryGetValue(K_MS_Description, out s))
            {
                mysmo_tt.Description = s;
                mysmo_tt.ExtendedProperties.Remove(K_MS_Description);
            }
            mysmo_tt.Columns = new List <MySmo.Column>();
            foreach (Smo.Column smo_c in smo_tt.Columns)
            {
                var mysmo_c = new MySmo.Column
                {
                    ParentDatabase    = parent,
                    ParentTableBase   = mysmo_tt,
                    Name              = smo_c.Name,
                    DataType          = GetDataType(smo_c),
                    Computed          = smo_c.Computed,
                    ComputedText      = smo_c.ComputedText,
                    Default           = smo_c.Default,
                    Identity          = smo_c.Identity,
                    IdentityIncrement = smo_c.IdentityIncrement,
                    IdentitySeed      = smo_c.IdentitySeed,
                    InPrimaryKey      = smo_c.InPrimaryKey,
                    IsForeignKey      = smo_c.IsForeignKey,
                    Nullable          = smo_c.Nullable,
                    RowGuidCol        = smo_c.RowGuidCol
                };
                mysmo_c.ExtendedProperties = GetExtendProperties(mysmo_c, smo_c.ExtendedProperties);
                s = "";
                if (mysmo_c.ExtendedProperties.TryGetValue(K_MS_Description, out s))
                {
                    mysmo_c.Description = s;
                    mysmo_c.ExtendedProperties.Remove(K_MS_Description);
                }
                mysmo_tt.Columns.Add(mysmo_c);
            }
            FormatExtendProperties(mysmo_tt);

            return(mysmo_tt);

            #endregion
        }
示例#2
0
 public void FormatExtendProperties(MySmo.UserDefinedTableType mysmo_tt)
 {
     CombineExtendProperties(mysmo_tt.ExtendedProperties);
     DistributeExtendProperties((MySmo.ITableBase)mysmo_tt);
 }