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); }
public void AddCustomType(DbCustomTypeInfo type) { _customTypes.Add(type); _dbObjectsByName[type.FullName] = type; }
public virtual void BuildCustomTypeDropSql(DbObjectChange change, DbCustomTypeInfo typeInfo) { }
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); }
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); } }
public void AddCustomType(DbCustomTypeInfo type) { _customDbTypes.Add(type); }