Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns all of the stored code definitions that have been previously applied as recorded in this journal.
        /// The order of the definitions does not matter since the names are used to match them up with the available ones
        /// that the MigrationsProvider finds.
        /// </summary>
        /// <returns></returns>
        public IReadOnlyList <DeployedStoredCodeDefinition> GetDeployedStoredCodeDefinitions()
        {
            var toReturn = new List <DeployedStoredCodeDefinition>();

            _selectCommand.Parameters["@Repeatable"].Value = true;
            using (var rdr = _selectCommand.ExecuteReader())
            {
                while (rdr.Read())
                {
                    //var migrationNumber = rdr.GetInt32(0);
                    var name = rdr.GetString(1);
                    //var complete = rdr.GetBoolean(2);
                    var fingerprint    = rdr.GetString(3);
                    var deployedScript = new DeployedStoredCodeDefinition(name, fingerprint);
                    toReturn.Add(deployedScript);
                }
            }
            return(toReturn);
        }