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