Exemplo n.º 1
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(env.ContentRootPath)
                          .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();

            // MEF initiliazation
            this.exportProvider = CompositionContainerFactory.Create();
            SettingsInitializer.Initialize <Settings>(
                this.exportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);
            SettingsInitializer.Initialize <DatabaseContextSettings>(
                this.exportProvider,
                SettingsDefaultValueProvider <DatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);
            SettingsInitializer.Initialize <UCenterEventDatabaseContextSettings>(
                this.exportProvider,
                SettingsDefaultValueProvider <UCenterEventDatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);

            CreateDatabaseIndexesAsync().Wait();
        }
Exemplo n.º 2
0
        private static async Task AssemblyInitializeAsync()
        {
            ExportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <Settings>(
                ExportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <Common.Settings.Settings>(
                ExportProvider,
                SettingsDefaultValueProvider <Common.Settings.Settings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <DatabaseContextSettings>(
                ExportProvider,
                SettingsDefaultValueProvider <DatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);

            var settings = ExportProvider.GetExportedValue <Common.Settings.Settings>();

            await InitProfileImageBlobsAsync(settings.DefaultProfileImageForFemaleBlobName);
            await InitProfileImageBlobsAsync(settings.DefaultProfileImageForMaleBlobName);
            await InitProfileImageBlobsAsync(settings.DefaultProfileThumbnailForFemaleBlobName);
            await InitProfileImageBlobsAsync(settings.DefaultProfileThumbnailForMaleBlobName);
        }
        private static async Task AssemblyInitializeAsync()
        {
            ExportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <UCenterTestSettings>(
                ExportProvider,
                SettingsDefaultValueProvider <UCenterTestSettings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <Settings>(
                ExportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <DatabaseContextSettings>(
                ExportProvider,
                SettingsDefaultValueProvider <DatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <UCenterEventDatabaseContextSettings>(
                ExportProvider,
                SettingsDefaultValueProvider <UCenterEventDatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);

            // TODO: This will break distributed unit test!
            // await InitProfileImageBlobsAsync(settings.DefaultProfileImageForFemaleBlobName);
            // await InitProfileImageBlobsAsync(settings.DefaultProfileImageForMaleBlobName);
            // await InitProfileImageBlobsAsync(settings.DefaultProfileThumbnailForFemaleBlobName);
            // await InitProfileImageBlobsAsync(settings.DefaultProfileThumbnailForMaleBlobName);
        }
Exemplo n.º 4
0
 private static void InitializeSettings(ExportProvider exportProvider)
 {
     SettingsInitializer.Initialize <Settings>(
         exportProvider,
         SettingsDefaultValueProvider <Settings> .Default,
         AppConfigurationValueProvider.Default);
 }
Exemplo n.º 5
0
        public static void AssemblyInitialize(TestContext context)
        {
            ExportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <Settings>(ExportProvider, SettingsDefaultValueProvider <Settings> .Default,
                                                      AppConfigurationValueProvider.Default);
            SettingsInitializer.Initialize <Common.Settings.Settings>(ExportProvider,
                                                                      SettingsDefaultValueProvider <Settings> .Default, AppConfigurationValueProvider.Default);
        }
Exemplo n.º 6
0
        public ExceptionFilter()
        {
            var ExportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <UCenterEventDatabaseContextSettings>(
                ExportProvider,
                SettingsDefaultValueProvider <UCenterEventDatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);
            this.eventTrace = ExportProvider.GetExportedValue <EventTrace>();
        }
Exemplo n.º 7
0
        /// <summary>
        ///     The application start event
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            ExportProvider exportProvider = CompositionContainerFactory.Create();

            ApplicationManager.InitializeApplication(GlobalConfiguration.Configuration, exportProvider);
            SettingsInitializer.Initialize <Settings>(
                exportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Function for application start.
        /// </summary>
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            ExportProvider exportProvider = CompositionContainerFactory.Create();

            WebApplicationManager.InitializeApplication(GlobalConfiguration.Configuration, exportProvider);
            SettingsInitializer.Initialize <Settings>(
                exportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);
        }
Exemplo n.º 9
0
        public UsersController()
        {
            var exportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <Settings>(
                exportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <DatabaseContextSettings>(
                exportProvider,
                SettingsDefaultValueProvider <DatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);

            Database = exportProvider.GetExportedValue <DatabaseContext>();
            Settings = exportProvider.GetExportedValue <Settings>();
        }
Exemplo n.º 10
0
 public PluginManager(string path)
 {
     this.path           = path;
     this.exportProvider = CompositionContainerFactory.Create();
     SettingsInitializer.Initialize <DatabaseContextSettings>(
         this.exportProvider,
         SettingsDefaultValueProvider <DatabaseContextSettings> .Default,
         AppConfigurationValueProvider.Default);
     this.database = exportProvider.GetExportedValue <ManagerDatabaseContext>();
     this.plugins  = this.GetPlugins(path);
     this.watcher  = new FileSystemWatcher(path, "*" + ManifestFileName);
     this.watcher.IncludeSubdirectories = true;
     this.watcher.NotifyFilter          = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.Size;
     this.watcher.Changed            += Watcher_Changed;
     this.watcher.Deleted            += Watcher_Changed;
     this.watcher.Created            += Watcher_Changed;
     this.watcher.EnableRaisingEvents = true;
 }
Exemplo n.º 11
0
        public ApiControllerBase(DatabaseContext database, Settings settings)
        {
            //Database = database;
            //Settings = settings;
            var exportProvider = CompositionContainerFactory.Create();

            SettingsInitializer.Initialize <Settings>(
                exportProvider,
                SettingsDefaultValueProvider <Settings> .Default,
                AppConfigurationValueProvider.Default);

            SettingsInitializer.Initialize <DatabaseContextSettings>(
                exportProvider,
                SettingsDefaultValueProvider <DatabaseContextSettings> .Default,
                AppConfigurationValueProvider.Default);

            Database = exportProvider.GetExportedValue <DatabaseContext>();
            Settings = exportProvider.GetExportedValue <Settings>();
        }