private static bool ExtensionsRequireUpdate(IEnumerable<ScriptedExtension> extensions, IApplicationDatabase applicationDatabase, IDatabaseProvider databaseProvider, string connectionString) { return (from x in extensions let current = applicationDatabase.GetExtensionExecutedScripts(databaseProvider.GetConnectionFactory(connectionString), x) let required = applicationDatabase.GetExtensionRequiredScripts(x) let notRun = required.Select(z => z.Trim().ToLowerInvariant()) .Except(current.Select(z => z.Trim().ToLowerInvariant())) .ToList() where notRun.Count > 0 select current).Any(); }
private static bool ExtensionsRequireUpdate(IEnumerable <ScriptedExtension> extensions, IApplicationDatabase applicationDatabase, IDatabaseProvider databaseProvider, string connectionString) { var connectionFactory = databaseProvider.GetConnectionFactory(connectionString); return((from x in extensions let current = applicationDatabase.GetExtensionExecutedScripts(connectionFactory, x) let required = applicationDatabase.GetExtensionRequiredScripts(connectionFactory, x) let notRun = required.Select(z => z.Trim().ToLowerInvariant()) .Except(current.Select(z => z.Trim().ToLowerInvariant())) .ToList() where notRun.Count > 0 select current).Any()); }
private void CurrentExtensionVersionIs(int version) { applicationDatabase .GetExtensionExecutedScripts(Arg.Any <Func <IDbConnection> >(), Arg.Any <ScriptedExtension>()) .Returns(Enumerable.Range(1, version).Select(x => "Script" + x + ".sql").ToArray()); }