public void AddCommand(DbCommandInfo command) { Util.Check(!_dbObjectsByName.ContainsKey(command.FullCommandName), "Duplicate proc in DbModel: {0}", command.FullCommandName); if (command == null) { return; } _commands.Add(command); _dbObjectsByName[command.FullCommandName] = command; if (!string.IsNullOrWhiteSpace(command.DescriptiveTag)) { _commandsByTag[command.DescriptiveTag] = command; } }
public virtual void BuildStoredProcDropSql(DbObjectChange change, DbCommandInfo command) { change.AddScript(DbScriptType.RoutineDrop, "DROP PROCEDURE {0};", command.FullCommandName); }
public override void BuildStoredProcAddSql(DbObjectChange change, DbCommandInfo command) { base.BuildStoredProcAddSql(change, command); const string GrantTemplate = "GRANT EXECUTE ON {0} TO [{1}];"; if (command.EntityCommand.Kind.IsSelect()) { if(!string.IsNullOrWhiteSpace(Settings.GrantExecReadToRole)) change.AddScript(DbScriptType.Grant, GrantTemplate, command.FullCommandName, Settings.GrantExecReadToRole); } else { if (!string.IsNullOrWhiteSpace(Settings.GrantExecWriteToRole)) change.AddScript(DbScriptType.Grant, GrantTemplate, command.FullCommandName, Settings.GrantExecWriteToRole); } }
public virtual void BuildStoredProcAddSql(DbObjectChange change, DbCommandInfo command) { change.AddScript(DbScriptType.RoutineAdd, command.StoredProcText); }
private static bool StoredProceduresMatch(DbCommandInfo oldSp, DbCommandInfo newSp) { return newSp.SourceHash == oldSp.SourceHash; }