public virtual void StoreExecutedScript(SqlScript script, Func <IDbCommand> db) { var name = NameWithHash.FromScript(script); db.Execute(GetDeleteScriptSql(), new { scriptName = name.PlainName }); db.Execute(GetInsertScriptSql(), new { scriptName = name.PlainName, contentsHash = name.ContentsHash }); }
/// <summary> /// Given a set of scripts, returns new scripts with the same contents but /// names that are suitably suffixed with the script's hashed contents. This /// makes them compatible with <see cref="SqlHashingJournal"/>. /// </summary> /// <returns>The names.</returns> /// <param name="scripts">Scripts.</param> public static IEnumerable <SqlScript> HashNames(this IEnumerable <SqlScript> scripts) { return(scripts.Select(s => new SqlScript(NameWithHash.FromScript(s).ToString(), s.Contents))); }