/// <summary>
 /// Insert a record to the journal that a new stored code definition has been completely applied,
 /// or update an existing record with the new fingerprint of a stored code definition that has
 /// just been applied.
 /// </summary>
 /// <param name="storedCodeDefinition"></param>
 /// <param name="lastMigrationNumber"></param>
 public void RecordStoredCodeDefinition(StoredCodeDefinition storedCodeDefinition, int lastMigrationNumber)
 {
     // insert or update the fingerprint of a stored code definition.
     _upsertCommand.Parameters["@MigrationNumber"].Value = lastMigrationNumber;
     _upsertCommand.Parameters["@Name"].Value            = storedCodeDefinition.Name;
     _upsertCommand.Parameters["@Repeatable"].Value      = true;
     _upsertCommand.Parameters["@Complete"].Value        = true;
     _upsertCommand.Parameters["@CompletedTs"].Value     = DateTime.Now;
     _upsertCommand.Parameters["@Fingerprint"].Value     = storedCodeDefinition.Fingerprint;
     _upsertCommand.ExecuteNonQuery();
 }
Beispiel #2
0
        public void RecordStoredCodeDefinition(StoredCodeDefinition storedCodeDefinition, int lastMigrationNumber)
        {
            // need to look for the matching one by name
            var newDeployedDefinition = new DeployedStoredCodeDefinition(storedCodeDefinition.Name, storedCodeDefinition.Fingerprint);
            var fooundIndex           = _storedCodeDefinitions.FindIndex(
                d => d.Name.Equals(storedCodeDefinition.Name, StringComparison.OrdinalIgnoreCase));

            if (fooundIndex >= 0)
            {
                _storedCodeDefinitions[fooundIndex] = newDeployedDefinition;
            }
            else
            {
                _storedCodeDefinitions.Add(newDeployedDefinition);
            }
        }