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();
 }
Exemple #2
0
        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 RequiredExtensionVersionIs(int version)
 {
     applicationDatabase
     .GetExtensionRequiredScripts(Arg.Any <Func <IDbConnection> >(), Arg.Any <ScriptedExtension>())
     .Returns(Enumerable.Range(1, version).Select(x => "Script" + x + ".sql").ToArray());
 }