public override void Registros(IAssemblyScanner scan)
        {
            scan.AddAllTypesOf <IDatabaseProvider>();
            scan.AddAllTypesOf <Seed>();

            this.InitializeDatabase();
        }
Example #2
0
        //SKYOUT: private void ScanAllModulesForModuleSpecificODataBuilderTypes(IAssemblyScanner assemblyScanner)
        //{
        //    // Note that because we are in App.Core.Infrastructure, we can't see the
        //    // Typed version of this interface (as this assembly does not know anything
        //    // about OData as it does not have a Ref to OData Assemblies...nor should it, as that
        //    // woudl drag in way too many other dependencies (ApiControllers, Web, etc.)
        //    // So we search for and register the *untyped* version of the interface:

        //    //Scan for OData Model Builders in *all* modules.
        //    assemblyScanner.AddAllTypesOf<IAppODataModelBuilder>();
        //    //Scan for OData Model Builder Configuration fragments in *all* modules.
        //    assemblyScanner.AddAllTypesOf<IAppODataModelBuilderConfiguration>();
        //}



        // Scan across all known assemblies for DbContext related model definitions
        // And seeding definitions, and define the DbContext lifespan:
        private void ScanAllModulesForModuleSpecificDbContextTypes(IAssemblyScanner assemblyScanner)
        {
            // Register the Db Model definitions and seeder definitions for Core:
            assemblyScanner.AddAllTypesOf <IHasAppModuleDbContextModelBuilderInitializer>();
            assemblyScanner.AddAllTypesOf <IHasAppModuleDbContextSeedInitializer>();

            this.RegisterDbContextInHttpContext <AppCoreDbContext>(AppCoreDbContextNames.Core);
            For <HostSectionConfigurationManager>().Use <HostSectionConfigurationManager>().Singleton();
        }
Example #3
0
        // Scan across all known assemblies for DbContext related model definitions
        // And seeding definitions, and define the DbContext lifespan:
        private void ScanAllModulesForModuleSpecificDbContextTypes(IAssemblyScanner assemblyScanner)
        {
            // Register the Db Model definitions and seeder definitions for Core:
            assemblyScanner.AddAllTypesOf <IHasAppModuleDbContextModelBuilderInitializer>();
            assemblyScanner.AddAllTypesOf <IHasAppModuleDbContextSeedInitializer>();

            // Add all Pre-Commit Processors (these kick in just as you
            // Commit a DbContext, and ensure specific fields are
            // automatically filled in)
            assemblyScanner.AddAllTypesOf <IDbCommitPreCommitProcessingStrategy>();
            this.RegisterDbContextInHttpContext <AppModuleDbContext>(AppModuleDbContextNames.Default);
        }
Example #4
0
 private void ScanAllModulesForAllModulesPrecommitStrategies(IAssemblyScanner assemblyScanner)
 {
     // Add all Pre-Commit Processors (these kick in just as you
     // Commit a DbContext, and ensure specific fields are
     // automatically filled in)
     assemblyScanner.AddAllTypesOf <IDbCommitPreCommitProcessingStrategy>();
 }
Example #5
0
        private void ScanTypes(IAssemblyScanner scanner)
        {
            scanner.AssembliesFromApplicationBaseDirectory();
            scanner.AddAllTypesOf <ITask>();

            // Logging
            For <ILogger>().Use(x => _logger);

            // Powershell
            For <IPowershellRunner>().Use <PowershellRunner>();
            For <IFileProvider>().Use <FileProvider>();

            // YAML
            For <IConfigFileReader>().Use <ConfigFileReader>();
            For <Dictionary <string, ITask> >().Use("TasksAsDictionary", context =>
            {
                return(TasksAsDictionary(context.GetAllInstances <ITask>()));
            });
            For <IYamlConfigParser>().Use("IYamlConfigParser", context =>
            {
                var configFileReader = context.GetInstance <IConfigFileReader>();
                var tasks            = context.GetInstance <Dictionary <string, ITask> >();

                return(new YamlConfigParser(configFileReader, tasks, _logger));
            });
        }
Example #6
0
 /// <summary>
 /// Extension method to help with scanning assemblies in the solution for handler types
 /// </summary>
 /// <param name="scanner"></param>
 public static void ScanForHandlers(this IAssemblyScanner scanner)
 {
     scanner.TheCallingAssembly();
     scanner.AssemblyContainingType <IHandlerBase>();
     scanner.AssembliesFromApplicationBaseDirectory();
     scanner.AddAllTypesOf <IHandlerBase>();
 }
Example #7
0
        private void ScanAllModulesForAllModulesDataBuilderTypes(IAssemblyScanner assemblyScanner)
        {
            //TODO: Mystery...when we move the scanning to this assembly (Core.Application)
            // It no longer sees everything.
            //return;

            // Note that because we are in App.Core.Infrastructure, we can't see the
            // Typed version of this interface (as this assembly does not know anything
            // about OData as it does not have a Ref to OData Assemblies...nor should it, as that
            // woudl drag in way too many other dependencies (ApiControllers, Web, etc.)
            // So we search for and register the *untyped* version of the interface:

            //Scan for OData Model Builders in *all* modules.
            assemblyScanner.AddAllTypesOf <IAppOdataModelBuilder>();              //todo delete dont think used anymore
            //Scan for OData Model Builder Configuration fragments in *all* modules.
            assemblyScanner.AddAllTypesOf <IAppOdataModelBuilderConfiguration>(); //todo delete dont think used anymore
            assemblyScanner.AddAllTypesOf <IAppCoreOdataModelBuilderConfiguration>();
            assemblyScanner.AddAllTypesOf <IModelConfiguration>();
        }
Example #8
0
        private void ScanThisModulesForODataModelBuilderTypes(IAssemblyScanner assemblyScanner)
        {
            // Note that because we are in App.Core.Infrastructure, we can't see the
            // Typed version of this interface (as this assembly does not know anything
            // about OData as it does not have a Ref to OData Assemblies...nor should it, as that
            // woudl drag in way too many other dependencies (ApiControllers, Web, etc.)
            // So we search for and register the *untyped* version of the interface:

            //Scan for OData Model Builder Configuration fragments in *this* modules.
            assemblyScanner.AddAllTypesOf <IAppModuleOdataModelBuilderConfiguration>();
        }
Example #9
0
        public static void Scan(IAssemblyScanner scan)
        {
            var projectPrefix = ConfigurationManager.AppSettings["IoCProjectPrefix"];

            scan.TheCallingAssembly();
            scan.AssembliesFromApplicationBaseDirectory(
                y =>
                y.FullName.StartsWith(projectPrefix) &&
                !y.FullName.EndsWith("Tests"));
            scan.AddAllTypesOf(typeof(IRepository <>));
            scan.ConnectImplementationsToTypesClosing(typeof(IRepository <>));
            scan.WithDefaultConventions();
            scan.LookForRegistries();
        }
Example #10
0
 private void ScanAllModulesForAllModulesAutoMapperInitializers(IAssemblyScanner assemblyScanner)
 {
     // Register all Automapper Instances, which ever assembly they are in :
     assemblyScanner.AddAllTypesOf <IHasAutomapperInitializer>();
 }
Example #11
0
        private void Scan(IAssemblyScanner scanner)
        {
            scanner.TheCallingAssembly();
            scanner.SingleImplementationsOfInterface();
            scanner.WithDefaultConventions();

            // Copy all plugins to the /bin/Plugins folder
            CopyPlugins();

            // Scan plugins
            foreach (string subDirectory in Directory.GetDirectories(_applicationSettings.PluginsBinPath))
            {
                scanner.AssembliesFromPath(subDirectory);
            }

            // UserServiceBase is scanned below
            // Scan for TextPlugins
            scanner.AddAllTypesOf <TextPlugin>();

            // Scan for SpecialPages
            scanner.AddAllTypesOf <SpecialPagePlugin>();

            // The pluginfactory
            scanner.AddAllTypesOf <IPluginFactory>();

            // Config, repository, context
            scanner.AddAllTypesOf <ApplicationSettings>();
            scanner.AddAllTypesOf <IRepository>();
            scanner.AddAllTypesOf <IUserContext>();

            // Services and services
            scanner.AddAllTypesOf <ServiceBase>();
            scanner.AddAllTypesOf <IPageService>();
            scanner.AddAllTypesOf <IActiveDirectoryProvider>();
            scanner.AddAllTypesOf <UserServiceBase>();

            // Text parsers
            scanner.AddAllTypesOf <MarkupConverter>();
            scanner.AddAllTypesOf <CustomTokenParser>();

            // MVC Related
            scanner.AddAllTypesOf <Roadkill.Core.Mvc.Controllers.Api.ApiControllerBase>();
            scanner.AddAllTypesOf <Roadkill.Core.Mvc.Controllers.ControllerBase>();
            scanner.AddAllTypesOf <UserViewModel>();
            scanner.AddAllTypesOf <SettingsViewModel>();
            scanner.AddAllTypesOf <AttachmentRouteHandler>();
            scanner.AddAllTypesOf <ISetterInjected>();
            scanner.AddAllTypesOf <IAuthorizationAttribute>();
            scanner.AddAllTypesOf <RoadkillLayoutPage>();
            scanner.AddAllTypesOf(typeof(RoadkillViewPage <>));
            scanner.ConnectImplementationsToTypesClosing(typeof(RoadkillViewPage <>));

            // Emails
            scanner.AddAllTypesOf <SignupEmail>();
            scanner.AddAllTypesOf <ResetPasswordEmail>();

            // Cache
            scanner.AddAllTypesOf <ListCache>();
            scanner.AddAllTypesOf <PageViewModelCache>();

            // Export
            scanner.AddAllTypesOf <WikiExporter>();
        }
Example #12
0
 public static IAssemblyScanner AddAllTypesOf <T>(this IAssemblyScanner scanner)
 {
     return(scanner.AddAllTypesOf(typeof(T)));
 }
Example #13
0
        private void ScanTypes(IAssemblyScanner scanner)
        {
            scanner.TheCallingAssembly();
            scanner.AssembliesFromApplicationBaseDirectory(assembly => assembly.FullName.Contains("Roadkill"));
            scanner.SingleImplementationsOfInterface();
            scanner.WithDefaultConventions();

            // Scan plugins: this includes everything e.g repositories, UserService, FileService TextPlugins
            CopyPlugins(ApplicationSettings);
            foreach (string subDirectory in Directory.GetDirectories(ApplicationSettings.PluginsBinPath))
            {
                scanner.AssembliesFromPath(subDirectory);
            }

            // Plugins
            scanner.With(new AbstractClassConvention <TextPlugin>());
            scanner.With(new AbstractClassConvention <SpecialPagePlugin>());
            scanner.AddAllTypesOf <IPluginFactory>();

            // Config, context
            scanner.AddAllTypesOf <ApplicationSettings>();
            scanner.AddAllTypesOf <IUserContext>();

            // Repositories
            scanner.AddAllTypesOf <ISettingsRepository>();
            scanner.AddAllTypesOf <IUserRepository>();
            scanner.AddAllTypesOf <IPageRepository>();

            // Services
            scanner.With(new AbstractClassConvention <UserServiceBase>());
            scanner.AddAllTypesOf <IPageService>();
            scanner.AddAllTypesOf <ISearchService>();
            scanner.AddAllTypesOf <ISettingsService>();
            scanner.AddAllTypesOf <IActiveDirectoryProvider>();
            scanner.AddAllTypesOf <IFileService>();
            scanner.AddAllTypesOf <IInstallationService>();

            // Text parsers
            scanner.AddAllTypesOf <MarkupConverter>();
            scanner.AddAllTypesOf <CustomTokenParser>();

            // MVC Related
            scanner.AddAllTypesOf <UserViewModel>();
            scanner.AddAllTypesOf <SettingsViewModel>();
            scanner.AddAllTypesOf <AttachmentRouteHandler>();
            scanner.AddAllTypesOf <ISetterInjected>();
            scanner.AddAllTypesOf <IAuthorizationAttribute>();
            scanner.AddAllTypesOf <RoadkillLayoutPage>();
            scanner.AddAllTypesOf(typeof(RoadkillViewPage <>));
            scanner.ConnectImplementationsToTypesClosing(typeof(RoadkillViewPage <>));

            // Emails
            scanner.AddAllTypesOf <SignupEmail>();
            scanner.AddAllTypesOf <ResetPasswordEmail>();

            // Cache
            scanner.AddAllTypesOf <ListCache>();
            scanner.AddAllTypesOf <PageViewModelCache>();

            // Export
            scanner.AddAllTypesOf <WikiExporter>();

            // Controllers
            scanner.AddAllTypesOf <IRoadkillController>();
            scanner.AddAllTypesOf <ControllerBase>();
            scanner.AddAllTypesOf <ApiController>();
            scanner.AddAllTypesOf <ConfigurationTesterController>();
        }
Example #14
0
        private void Scan(IAssemblyScanner scanner)
        {
            scanner.TheCallingAssembly();
            scanner.SingleImplementationsOfInterface();
            scanner.WithDefaultConventions();

            // Copy all plugins to the /bin/Plugins folder
            CopyPlugins();

            // Scan plugins
            foreach (string subDirectory in Directory.GetDirectories(_applicationSettings.PluginsBinPath))
            {
                scanner.AssembliesFromPath(subDirectory);
            }

            // UserServiceBase is scanned below
            // Scan for TextPlugins
            scanner.AddAllTypesOf<TextPlugin>();

            // Scan for SpecialPages
            scanner.AddAllTypesOf<SpecialPagePlugin>();

            // The pluginfactory
            scanner.AddAllTypesOf<IPluginFactory>();

            // Config, repository, context
            scanner.AddAllTypesOf<ApplicationSettings>();
            scanner.AddAllTypesOf<IRepository>();
            scanner.AddAllTypesOf<IUserContext>();

            // Services and services
            scanner.AddAllTypesOf<ServiceBase>();
            scanner.AddAllTypesOf<IPageService>();
            scanner.AddAllTypesOf<IActiveDirectoryProvider>();
            scanner.AddAllTypesOf<UserServiceBase>();
            scanner.AddAllTypesOf<IFileService>();

            // Text parsers
            scanner.AddAllTypesOf<MarkupConverter>();
            scanner.AddAllTypesOf<CustomTokenParser>();

            // MVC Related
            scanner.AddAllTypesOf<Roadkill.Core.Mvc.Controllers.Api.ApiControllerBase>();
            scanner.AddAllTypesOf<Roadkill.Core.Mvc.Controllers.ControllerBase>();
            scanner.AddAllTypesOf<UserViewModel>();
            scanner.AddAllTypesOf<SettingsViewModel>();
            scanner.AddAllTypesOf<AttachmentRouteHandler>();
            scanner.AddAllTypesOf<ISetterInjected>();
            scanner.AddAllTypesOf<IAuthorizationAttribute>();
            scanner.AddAllTypesOf<RoadkillLayoutPage>();
            scanner.AddAllTypesOf(typeof(RoadkillViewPage<>));
            scanner.ConnectImplementationsToTypesClosing(typeof(RoadkillViewPage<>));

            // Emails
            scanner.AddAllTypesOf<SignupEmail>();
            scanner.AddAllTypesOf<ResetPasswordEmail>();

            // Cache
            scanner.AddAllTypesOf<ListCache>();
            scanner.AddAllTypesOf<PageViewModelCache>();

            // Export
            scanner.AddAllTypesOf<WikiExporter>();
        }
 private static void RegisterApplicationTypes(IAssemblyScanner scanner)
 {
     scanner.AddAllTypesOf <IDependencyConfig>();
     scanner.AddAllTypesOf <IInitializer>();
 }
Example #16
0
 private void ScanAllModulesForAllModulesOIDCFullyQualifiesScopes(IAssemblyScanner assemblyScanner)
 {
     assemblyScanner.AddAllTypesOf <IHasOidcScopeInitializer>();
 }
 private void ScanAllModulesForModuleSpecificODataModelBuilderConfigurationTypes(IAssemblyScanner assemblyScanner)
 {
     assemblyScanner.AddAllTypesOf <IAppCoreOdataModelBuilderConfiguration>();
 }