private Importer(Schema schema, DbConnection connection, Func<string, Schema> resolve, Action<string> log) : base(connection) { this.schema = schema; this.connection = connection; _resolve = resolve; this.log = log ?? (s => { }); }
public static void Upgrade(Schema schema, DbConnection connection, Func<string, Schema> resolve, bool forceFullUpdate, Action<string> log) { if (schema == null) throw new ArgumentNullException("schema"); if (connection == null) throw new ArgumentNullException("connection"); new Importer(schema, connection, resolve, log).InternalUpgrade(forceFullUpdate); }
private void ProcessIncludes(bool skipVersionCheck) { if (schema.Includes == null) return; int oldVersion = version; Schema oldSchema = schema; try { foreach (var name in schema.Includes) { version = -1; var timer = new Stopwatch(); timer.Start(); schema = _resolve(name); timer.Stop(); DebugLog("Load Schema: {0} {1}ms", name, timer.ElapsedMilliseconds); ProcessUpgrade(skipVersionCheck); } } finally { version = oldVersion; schema = oldSchema; } }