Example #1
0
 public override void BuildCustomTypeAddSql(DbObjectChange change, DbCustomTypeInfo typeInfo)
 {
     var sqlCreateTemplate = "CREATE TYPE {0} AS TABLE ([Value] Sql_Variant);";
       var sqlGrantTemplate = "Grant EXECUTE on TYPE::{0} to {1};";
       change.AddScript(DbScriptType.CustomTypeAdd, sqlCreateTemplate, typeInfo.FullName);
       if (!string.IsNullOrWhiteSpace(Settings.GrantExecReadToRole))
     change.AddScript(DbScriptType.CustomTypeAdd, sqlGrantTemplate, typeInfo.FullName, Settings.GrantExecReadToRole);
       if (!string.IsNullOrWhiteSpace(Settings.GrantExecWriteToRole) && Settings.GrantExecWriteToRole != Settings.GrantExecReadToRole)
     change.AddScript(DbScriptType.CustomTypeAdd, sqlGrantTemplate, typeInfo.FullName, Settings.GrantExecWriteToRole);
 }
Example #2
0
 public void AddCustomType(DbCustomTypeInfo type)
 {
     _customTypes.Add(type);
     _dbObjectsByName[type.FullName] = type;
 }
Example #3
0
 public virtual void BuildCustomTypeDropSql(DbObjectChange change, DbCustomTypeInfo typeInfo)
 {
 }
Example #4
0
 public override void BuildCustomTypeDropSql(DbObjectChange change, DbCustomTypeInfo typeInfo)
 {
     // We drop only Vita_* automatic types
       if (typeInfo.Name.StartsWith("Vita_"))
     change.AddScript(DbScriptType.CustomTypeDrop, "DROP TYPE {0};", typeInfo.FullName);
 }
Example #5
0
 protected virtual void LoadUserDefinedTypes()
 {
     var data = GetUserDefinedTypes();
       foreach (DataRow row in data.Rows) {
     var schema = row.GetAsString("TYPE_SCHEMA");
     var name = row.GetAsString("TYPE_NAME");
     var typeInfo = new DbCustomTypeInfo(this.Model, schema, name);
     this.Model.AddCustomType(typeInfo);
       }
 }
Example #6
0
 public void AddCustomType(DbCustomTypeInfo type)
 {
     _customDbTypes.Add(type);
 }