Example #1
0
 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;
     }
 }
Example #2
0
 public virtual void BuildStoredProcDropSql(DbObjectChange change, DbCommandInfo command)
 {
     change.AddScript(DbScriptType.RoutineDrop, "DROP PROCEDURE {0};", command.FullCommandName);
 }
Example #3
0
 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);
       }
 }
Example #4
0
 public virtual void BuildStoredProcAddSql(DbObjectChange change, DbCommandInfo command)
 {
     change.AddScript(DbScriptType.RoutineAdd, command.StoredProcText);
 }
Example #5
0
 private static bool StoredProceduresMatch(DbCommandInfo oldSp, DbCommandInfo newSp)
 {
     return newSp.SourceHash == oldSp.SourceHash;
 }