protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);

            if (!Directory.Exists(extensionsPath))
                return;

            var container = new CompositionContainer(
                new DirectoryCatalog(extensionsPath)
                );

            container.SatisfyImportsOnce(this);
            foreach (var export in Extensions)
            {
                var extension = export.Value;
                var controller = extension as RoutableFunnelWebExtension;
                var requiresScripts = extension as IRequireDatabaseScripts;

                if (requiresScripts != null)
                {
                    var ex = new ScriptedExtension(
                        requiresScripts.SourceIdentifier,
                        extension.GetType().Assembly,
                        new EmbeddedScriptProvider(
                            extension.GetType().Assembly,
                            script => script.EndsWith(".sql")));

                    builder.RegisterInstance(ex);
                }

                if (controller != null)
                {
                    controller.Routes = routes;
                    controller.Initialize(builder);
                    controller.RegisterControllers(builder);
                }
                else
                {
                    extension.Initialize(builder);
                }
                builder.RegisterInstance(export.Metadata).As<IFunnelWebExtensionMetaData>();
            }
        }
 public string[] GetExtensionRequiredScripts(ScriptedExtension extension)
 {
     return extension.ScriptProvider.GetScripts().Select(x => x.Name).ToArray();
 }
 public string[] GetExtensionExecutedScripts(string connectionString, ScriptedExtension extension, string schema)
 {
     return CreateJournal(connectionString, extension.SourceIdentifier, schema).GetExecutedScripts();
 }
Esempio n. 4
0
 public string[] GetExtensionExecutedScripts(Func<IDbConnection> connectionFactory, ScriptedExtension extension)
 {
     return CreateJournal(connectionFactory, extension.SourceIdentifier, connectionStringSettings.Schema).GetExecutedScripts();
 }
 public string[] GetExtensionRequiredScripts(Func <IDbConnection> connectionFactory, ScriptedExtension extension)
 {
     return(extension.ScriptProvider.GetScripts(null).Select(x => x.Name).ToArray());
 }
 public string[] GetExtensionExecutedScripts(Func <IDbConnection> connectionFactory, ScriptedExtension extension)
 {
     return(CreateJournal(connectionFactory, extension.SourceIdentifier, connectionStringSettings.Schema).GetExecutedScripts());
 }
Esempio n. 7
0
 public string[] GetExtensionRequiredScripts(Func<IDbConnection> connectionFactory, ScriptedExtension extension)
 {
     return extension.ScriptProvider.GetScripts(connectionFactory).Select(x => x.Name).ToArray();
 }