Exemple #1
0
        public MySmo.StoredProcedure GetStoredProcedure(Smo.StoredProcedure smo_sp, MySmo.Database parent = null)
        {
            #region implement

            SetDataLimit();

            var mysmo_sp = new MySmo.StoredProcedure();

            mysmo_sp.ParentDatabase     = parent;
            mysmo_sp.Name               = smo_sp.Name;
            mysmo_sp.Schema             = smo_sp.Schema;
            mysmo_sp.CreateTime         = smo_sp.CreateDate;
            mysmo_sp.Owner              = smo_sp.Owner;
            mysmo_sp.ExtendedProperties = GetExtendProperties(mysmo_sp, smo_sp.ExtendedProperties);
            var s = "";
            if (mysmo_sp.ExtendedProperties.TryGetValue(K_MS_Description, out s))
            {
                mysmo_sp.Description = s;
                mysmo_sp.ExtendedProperties.Remove(K_MS_Description);
            }
            mysmo_sp.Parameters = new List <MySmo.Parameter>();
            foreach (Smo.StoredProcedureParameter smo_p in smo_sp.Parameters)
            {
                var mysmo_p = new MySmo.Parameter
                {
                    ParentDatabase      = parent,
                    ParentParameterBase = mysmo_sp,
                    Name              = smo_p.Name.Substring(1),
                    DefaultValue      = smo_p.DefaultValue,
                    IsOutputParameter = smo_p.IsOutputParameter,
                    IsReadOnly        = smo_p.IsReadOnly,
                    DataType          = new MySmo.DataType
                    {
                        Name             = smo_p.DataType.Name,
                        Schema           = smo_p.DataType.Schema,
                        MaximumLength    = smo_p.DataType.MaximumLength,
                        NumericPrecision = smo_p.DataType.NumericPrecision,
                        NumericScale     = smo_p.DataType.NumericScale,
                        SqlDataType      = (MySmo.SqlDataType)(int) smo_p.DataType.SqlDataType
                    }
                };
                mysmo_sp.Parameters.Add(mysmo_p);
            }

            FormatExtendProperties(mysmo_sp);

            return(mysmo_sp);

            #endregion
        }
Exemple #2
0
 public void FormatExtendProperties(MySmo.StoredProcedure mysmo_sp)
 {
     CombineExtendProperties(mysmo_sp.ExtendedProperties);
     DistributeExtendProperties((MySmo.IParameterBase)mysmo_sp);
 }