예제 #1
0
 public static void Config(ConfigurationResolver <ConfigLessUserInplaceDirectConfig> configBase)
 {
     configBase.SetClassAttribute(new ForModelAttribute(UsersMeta.TableName));
     configBase.SetPrimaryKey(e => e.PropertyA);
     configBase.SetForModelKey(e => e.PropertyA, UsersMeta.PrimaryKeyName);
     configBase.SetForModelKey(e => e.PropertyB, UsersMeta.ContentName);
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractService"/> class.
        /// </summary>
        /// <param name="glassContext">The glass context.</param>
        /// <exception cref="System.NullReferenceException">Context is null</exception>
        protected AbstractService(Context glassContext)
        {
            GlassContext = glassContext;
            if (GlassContext == null)
            {
                throw new NullReferenceException("Context is null");
            }

            var objectConstructionTasks = glassContext.DependencyResolver.ObjectConstructionFactory.GetItems();

            _objectConstruction = new ObjectConstruction(objectConstructionTasks);

            var configurationResolverTasks = glassContext.DependencyResolver.ConfigurationResolverFactory.GetItems();

            _configurationResolver = new ConfigurationResolver(configurationResolverTasks);

            var objectSavingTasks = glassContext.DependencyResolver.ObjectSavingFactory.GetItems();

            _objectSaving = new ObjectSaving(objectSavingTasks);



            Profiler = NullProfiler.Instance;

            Initiate(glassContext.DependencyResolver);
        }
예제 #3
0
        public void when_there_is_no_base_configuration_then_the_resulting_config_is_not_combined()
        {
            var resolver      = new ConfigurationResolver();
            var configuration = resolver.Resolve();

            Assert.That(configuration, Is.Not.TypeOf <CombinedSpectatorConfiguration>());
        }
예제 #4
0
        public static void Save(string account, string server, string name)
        {
            LastCharacterInfo lastChar = LastCharacters.FirstOrDefault(c => c.AccountName.Equals(account) && c.ServerName == server);

            // Check to see if they passed in -lastcharactername but picked another character, clear override then
            if (!string.IsNullOrEmpty(LastCharacterNameOverride) && !LastCharacterNameOverride.Equals(name))
            {
                LastCharacterNameOverride = string.Empty;
            }

            if (lastChar != null)
            {
                lastChar.LastCharacterName = name;
            }
            else
            {
                LastCharacters.Add(new LastCharacterInfo
                {
                    ServerName        = server,
                    LastCharacterName = name,
                    AccountName       = account
                });
            }

            ConfigurationResolver.Save(LastCharacters, _lastCharacterFile);
        }
예제 #5
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options => options.AddPolicy(CrosPolicyName, builder =>
                                                          builder.WithHeaders("content-type", "authorization")
                                                          .WithMethods(Configuration.GetValue <string>("AllowedMethods").Split(','))
                                                          .AllowAnyOrigin()));

            services.AddMvc(options =>
            {
                options.Filters.Add(typeof(GlobalExceptionFilter));
            })
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddFluentValidation();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new Info {
                    Title = "Chat API", Version = "v1"
                });
                //c.IncludeXmlComments(Path.Combine(System.AppContext.BaseDirectory, "CBH.Chat.Web.Services.xml"));
            });

            services.AddOptions();

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();
            services.AddModule(new SecurityModule(CredibleSettingsConfiguration));
            services.AddModule(new CacheModule(ConfigurationResolver.GetConfiguration <RedisCacheConfiguration>(Configuration)));
            services.AddModule(new ContextModule(ConfigurationResolver.GetConfiguration <ConnectionStringsConfiguration>(Configuration)));
            services.AddModule(new ServicesModule());
        }
    string AzureConfigurationSourceReplacementExample()
    {
        #region azure-configuration-source-replacement

        var    sectionName   = "mySection";
        var    attributeName = "myAttribute";
        string value;
        if (SafeRoleEnvironment.IsAvailable)
        {
            var key = sectionName + "." + attributeName;
            value = SafeRoleEnvironment.GetConfigurationSettingValue(key);
        }
        else
        {
            var section = ConfigurationResolver.GetConfigurationHandler()
                          .GetSection(sectionName) as MyConfigurationSection;
            value = section.MyAttribute;
        }

        // return value; // value for mySection.myAttribute

        #endregion

        return(value);
    }
예제 #7
0
 public static void Setup(this IServiceCollection services, AppSettings appSettings)
 {
     ConfigurationResolver.Setup(services, appSettings);
     ServiceResolver.Setup(services);
     DataResolver.Setup(services, appSettings);
     ExternalServiceResolver.Setup(services);
 }
예제 #8
0
        private void SetupMqttClient()
        {
            var solarEdgeSetting = Resolver.CreateConcreteInstanceWithDependencies <SolarEdgeSetting>();


            var lwtMessage = new MqttApplicationMessageBuilder()
                             .WithRetainFlag(true)
                             .WithTopic("tele/solaredge/LWT")
                             .WithPayload("offline")
                             .Build();
            var clientOptions = new MqttClientOptionsBuilder().WithClientId("SolarEdge")
                                .WithTcpServer(solarEdgeSetting.MqttAddress)
                                .WithWillMessage(lwtMessage);

            if (!string.IsNullOrWhiteSpace(solarEdgeSetting.MqttUsername))
            {
                clientOptions.WithCredentials(solarEdgeSetting.MqttUsername, solarEdgeSetting.MqttPassword);
            }

            var options = new ManagedMqttClientOptionsBuilder().WithAutoReconnectDelay(TimeSpan.FromSeconds(5))
                          .WithClientOptions(clientOptions.Build())
                          .Build();

            var mqttClient = new MqttFactory().CreateManagedMqttClient();

            mqttClient.StartAsync(options).Wait();

            ConfigurationResolver.AddRegistration(new SingletonRegistration <IManagedMqttClient>(mqttClient));
        }
예제 #9
0
 protected void ApplyRegistrations(IEnumerable <DependencyResolverRegistration> registrations)
 {
     foreach (var registration in registrations)
     {
         ConfigurationResolver.AddRegistration(registration);
     }
 }
        public void Given_EnvironmentVariables_When_Instantiated_Then_It_Should_Return_Result(string hideSwaggerUI, bool expectedHideSwaggerUI,
                                                                                              string hideDocument, bool expectedHideDocument,
                                                                                              string apiKey,
                                                                                              string authLevelDoc, AuthorizationLevel expectedAuthLevelDoc,
                                                                                              string authLevelUI, AuthorizationLevel expectedAuthLevelUI,
                                                                                              string proxyUrl, string hostnames)
        {
            Environment.SetEnvironmentVariable("OpenApi__HideSwaggerUI", hideSwaggerUI);
            Environment.SetEnvironmentVariable("OpenApi__HideDocument", hideDocument);
            Environment.SetEnvironmentVariable("OpenApi__ApiKey", apiKey);
            Environment.SetEnvironmentVariable("OpenApi__AuthLevel__Document", authLevelDoc);
            Environment.SetEnvironmentVariable("OpenApi__AuthLevel__UI", authLevelUI);
            Environment.SetEnvironmentVariable("OpenApi__BackendProxyUrl", proxyUrl);
            Environment.SetEnvironmentVariable("OpenApi__HostNames", hostnames);

            var config   = ConfigurationResolver.Resolve();
            var settings = config.Get <OpenApiSettings>("OpenApi");

            settings.HideSwaggerUI.Should().Be(expectedHideSwaggerUI);
            settings.HideDocument.Should().Be(expectedHideDocument);
            settings.ApiKey.Should().Be(apiKey);
            settings.AuthLevel.Document.Should().Be(expectedAuthLevelDoc);
            settings.AuthLevel.UI.Should().Be(expectedAuthLevelUI);
            settings.BackendProxyUrl.Should().Be(proxyUrl);
            settings.HostNames.Should().Be(hostnames);
        }
예제 #11
0
        public void Set_configrationSection_then_read()
        {
            var section1 = new CacheConfigurationSection {
                Pattern           = "{region}/{key}",
                FormatNullRegion  = true,
                MaxExpirationHour = 1D,
                Details           = new CacheItemElementCollection()
            };

            section1.Details.Add(new CacheItemDetailElement {
                Region           = "someRegion",
                Pattern          = "{region}//{key}",
                Provider         = typeof(RedisCacheProvider).FullName,
                FormatNullRegion = false,
            });


            var resolver = new ConfigurationResolver();

            resolver.ExeConfigFilename = "test.config";
            resolver.Save(section1, "cacheBuilder");

            var section2 = resolver.Read <CacheConfigurationSection>("cacheBuilder");

            Assert.AreEqual(section2.Pattern, section1.Pattern);
            Assert.AreEqual(section2.FormatNullRegion, section1.FormatNullRegion);
            Assert.AreEqual(section2.MaxExpirationHour, section1.MaxExpirationHour);
            Assert.IsNotNull(section2.Details);
            Assert.AreEqual(section2.Details.Count, section1.Details.Count);
            Assert.AreEqual(
                section2.Details.Get(typeof(RedisCacheProvider).FullName),
                section1.Details.Get(typeof(RedisCacheProvider).FullName)
                );
        }
        /// <summary>
        /// Gets the <see cref="IConfiguration"/> instance from openapisettings.json
        /// </summary>
        /// <param name="config"><see cref="IConfiguration"/> instance from the environment variables - either local.settings.json or App Settings blade.</param>
        /// <param name="basePath">Base path of the executing Azure Functions assembly.</param>
        public static IConfiguration Resolve(IConfiguration config = null, string basePath = null)
        {
            if (config.IsNullOrDefault())
            {
                config = ConfigurationResolver.Resolve();
            }

            if (basePath.IsNullOrWhiteSpace())
            {
                basePath = ConfigurationResolver.GetBasePath(config);
            }

            var builder = new ConfigurationBuilder();

            if (!File.Exists($"{basePath.TrimEnd('/')}/openapisettings.json"))
            {
                return(builder.Build());
            }

            var openapi = builder.SetBasePath(basePath)
                          .AddJsonFile("openapisettings.json")
                          .Build();

            return(openapi);
        }
예제 #13
0
 protected override void ActivateInternal()
 {
     foreach (var registration in CreateRegistrations())
     {
         ConfigurationResolver.AddRegistration(registration);
     }
 }
        /// <inheritdoc />
        public void Configure(IWebJobsBuilder builder)
        {
            var config   = ConfigurationResolver.Resolve();
            var settings = config.Get <OpenApiSettings>(OpenApiSettingsKey);

            builder.Services.AddSingleton(settings);
            builder.Services.AddSingleton <IFunctionProvider, OpenApiTriggerFunctionProvider>();
        }
예제 #15
0
 public static void Configuration(ConfigurationResolver <Genre> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetPropertyAttribute(s => s.GenreId, new PrimaryKeyAttribute());
     config.SetPropertyAttribute(s => s.Season, new ForeignKeyAttribute(referenceKey: "IdGenre", foreignKey: "GenreId"));
     AfterConfig(config);
     AfterConfig();
 }
예제 #16
0
        private Engine(Settings settings)
        {
            Instance  = this;
            _settings = settings ?? ConfigurationResolver.Load <Settings>(Path.Combine(ExePath, "settings.json"));

            if (_settings == null)
            {
                SDL.SDL_ShowSimpleMessageBox(SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_INFORMATION, "No `setting.json`", "A `settings.json` has been created into ClassicUO main folder.\nPlease fill it!", SDL.SDL_GL_GetCurrentWindow());
                Log.Message(LogTypes.Trace, "settings.json file not found");
                _settings = new Settings();
                _settings.Save();
                IsQuitted = true;
                return;
            }

            TargetElapsedTime = TimeSpan.FromSeconds(1.0f / MAX_FPS);
            IsFixedTimeStep   = _settings.FixedTimeStep;

            _graphicDeviceManager = new GraphicsDeviceManager(this);
            _graphicDeviceManager.PreparingDeviceSettings += (sender, e) => e.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;

            if (_graphicDeviceManager.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef))
            {
                _graphicDeviceManager.GraphicsProfile = GraphicsProfile.HiDef;
            }
            _graphicDeviceManager.PreferredDepthStencilFormat    = DepthFormat.Depth24Stencil8;
            _graphicDeviceManager.SynchronizeWithVerticalRetrace = false;
            _graphicDeviceManager.ApplyChanges();

            _isHighDPI = Environment.GetEnvironmentVariable("FNA_GRAPHICS_ENABLE_HIGHDPI") == "1";
            _window    = Window;

            Window.ClientSizeChanged += (sender, e) =>
            {
                int width  = Window.ClientBounds.Width;
                int height = Window.ClientBounds.Height;

                if (_isHighDPI)
                {
                    width  *= 2;
                    height *= 2;
                }

                _graphicDeviceManager.PreferredBackBufferWidth  = width;
                _graphicDeviceManager.PreferredBackBufferHeight = height;
                _graphicDeviceManager.ApplyChanges();

                WorldViewportGump gump = _uiManager.GetByLocalSerial <WorldViewportGump>();

                if (gump != null && _profileManager.Current.GameWindowFullSize)
                {
                    gump.ResizeWindow(new Point(WindowWidth, WindowHeight));
                }
            };
            Window.AllowUserResizing = true;
            IsMouseVisible           = true;
        }
예제 #17
0
 public static void Configuration(ConfigurationResolver <AppRole> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetPropertyAttribute(s => s.AppRoleId, new PrimaryKeyAttribute());
     config.SetPropertyAttribute(s => s.AppUser, new ForeignKeyAttribute(referenceKey: "IdRole", foreignKey: "AppRoleId"));
     AfterConfig(config);
     AfterConfig();
 }
예제 #18
0
        public TContext CreateDbContext(string[] args)
        {
            var config         = ConfigurationResolver.GetConfiguration();
            var optionsBuilder = new DbContextOptionsBuilder <TContext>();

            optionsBuilder.UseSqlite(config.GetConnectionString("SqLite"),
                                     builder => builder.MigrationsAssembly(typeof(TContext).Assembly.FullName));
            return(CreateNewInstance(optionsBuilder.Options));
        }
예제 #19
0
        public PersistedGrantDbContext CreateDbContext(string[] args)
        {
            var config         = ConfigurationResolver.GetConfiguration();
            var optionsBuilder = new DbContextOptionsBuilder <PersistedGrantDbContext>();

            optionsBuilder.UseSqlite(config.GetConnectionString("SQLite"),
                                     sql => sql.MigrationsAssembly(typeof(PersistedGrantSqLiteDbContextFactory).GetTypeInfo().Assembly.GetName().Name));
            return(new PersistedGrantDbContext(optionsBuilder.Options, new OperationalStoreOptions()));
        }
예제 #20
0
 public static void ConfigUsers(ConfigurationResolver <Users> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetFactory(Factory, true);
     config.SetPropertyAttribute(s => s.UserID, new ForModelAttribute("User_ID"));
     config.SetPropertyAttribute(s => s.UserID, new PrimaryKeyAttribute());
     AfterConfig();
     AfterConfig(config);
 }
예제 #21
0
		public static void ConfigUsers(ConfigurationResolver<Users> config)
		{
			Users.BeforeConfig();
			Users.BeforeConfig(config);
			config.SetFactory(Users.Factory, true);
			config.SetPropertyAttribute(s => s.UserID, new ForModelAttribute("User_ID"));
			config.SetPropertyAttribute(s => s.UserID, new PrimaryKeyAttribute());
			Users.AfterConfig();
			Users.AfterConfig(config);
		}
예제 #22
0
 public static void Configuration(ConfigurationResolver <Title> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetPropertyAttribute(s => s.TitleId, new PrimaryKeyAttribute());
     config.SetPropertyAttribute(s => s.IdSeason, new ForeignKeyDeclarationAttribute(foreignKey: "SeasonId", foreignTable: typeof(Season)));
     config.SetPropertyAttribute(s => s.Season, new ForeignKeyAttribute(foreignKey: "IdSeason", referenceKey: "SeasonId"));
     config.SetPropertyAttribute(s => s.Playback, new ForeignKeyAttribute(referenceKey: "IdTitle", foreignKey: "TitleId"));
     AfterConfig(config);
     AfterConfig();
 }
예제 #23
0
 public static void Configuration(ConfigurationResolver <Users> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetPropertyAttribute(s => s.UserId, new PrimaryKeyAttribute());
     config.SetPropertyAttribute(s => s.IdAccount, new ForeignKeyDeclarationAttribute(foreignKey: "AppUserId", foreignTable: typeof(AppUser)));
     config.SetPropertyAttribute(s => s.AppUser, new ForeignKeyAttribute(foreignKey: "IdAccount", referenceKey: "AppUserId"));
     config.SetPropertyAttribute(s => s.Playback, new ForeignKeyAttribute(referenceKey: "IdUser", foreignKey: "UserId"));
     AfterConfig(config);
     AfterConfig();
 }
예제 #24
0
        public SqlServerContext CreateDbContext(string[] args)
        {
            var config         = ConfigurationResolver.GetConfiguration();
            var optionsBuilder = new DbContextOptionsBuilder <SqlServerContext>();

            optionsBuilder.UseSqlServer(config.GetConnectionString("SQLServer"),
                                        builder => builder.MigrationsAssembly(typeof(SqlServerContext).Assembly.FullName));
            var context = new SqlServerContext(optionsBuilder.Options);

            return(context);
        }
예제 #25
0
 public static void Configuration(ConfigurationResolver <Season> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetPropertyAttribute(s => s.SeasonId, new PrimaryKeyAttribute());
     config.SetPropertyAttribute(s => s.IdGenre, new ForeignKeyDeclarationAttribute(foreignKey: "GenreId", foreignTable: typeof(Genre)));
     config.SetPropertyAttribute(s => s.Genre, new ForeignKeyAttribute(foreignKey: "IdGenre", referenceKey: "GenreId"));
     config.SetPropertyAttribute(s => s.Title, new ForeignKeyAttribute(referenceKey: "IdSeason", foreignKey: "SeasonId"));
     AfterConfig(config);
     AfterConfig();
 }
예제 #26
0
 public static void Configuration(ConfigurationResolver <Playback> config)
 {
     BeforeConfig();
     BeforeConfig(config);
     config.SetPropertyAttribute(s => s.PlaybackId, new PrimaryKeyAttribute());
     config.SetPropertyAttribute(s => s.IdTitle, new ForeignKeyDeclarationAttribute(foreignKey: "TitleId", foreignTable: typeof(Title)));
     config.SetPropertyAttribute(s => s.IdUser, new ForeignKeyDeclarationAttribute(foreignKey: "UserId", foreignTable: typeof(Users)));
     config.SetPropertyAttribute(s => s.Title, new ForeignKeyAttribute(foreignKey: "IdTitle", referenceKey: "TitleId"));
     config.SetPropertyAttribute(s => s.Users, new ForeignKeyAttribute(foreignKey: "IdUser", referenceKey: "UserId"));
     AfterConfig(config);
     AfterConfig();
 }
예제 #27
0
        protected override void ActivateInternal()
        {
            _service = new SchedulingService();

            var schedulingServiceRegistration = new SingletonRegistration <ISchedulingService>(_service);

            ConfigurationResolver.AddRegistration(schedulingServiceRegistration);

            _service.StartScheduler();

            EventService.Register <SystemIsShutingDownMessage>(message =>
            {
                _service.StopScheduler();
            });
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var config = ConfigurationResolver.GetConfiguration();

            services.AddDbContext <SqlServerContext>(c =>
                                                     c.UseSqlServer(config.GetConnectionString("SQLServer")));
            services.AddControllersWithViews();
            // In production, the Angular files will be served from this directory
            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/dist";
            });

            services.AddSingleton <ILuceneService, LuceneService>();
        }
예제 #29
0
        protected override void ActivateInternal()
        {
            SetupDatabase();
            SetupMqttClient();

            ConfigurationResolver.AddRegistration(new SingletonRegistration <SolarEdgeApiClient, SolarEdgeApiClient>());
            ConfigurationResolver.AddRegistration(new SingletonRegistration <SiteListRepository, SiteListRepository>());

            var historyJob   = Resolver.CreateConcreteInstanceWithDependencies <SolarEdgeHistoryJob>();
            var powerFlowJob = Resolver.CreateConcreteInstanceWithDependencies <SolaredgePowerFlowJob>();

            var scheduler = Resolver.GetInstance <ISchedulingService>();

            scheduler.AddJob(historyJob, new PollingPlan(TimeSpan.FromHours(1)));
            scheduler.AddJob(powerFlowJob, new PollingPlan(TimeSpan.FromSeconds(5)));
        }
예제 #30
0
        protected override void ActivateInternal()
        {
            var loggerFactory = Resolver.GetInstance <ILogManager>();
            var factory       = new MongoFactory(Resolver.GetInstance <MongoSettings>(), loggerFactory.GetLogger(typeof(MongoFactory)));

            factory.LoadMappings();
            var dataAccessProvider = new MongoDataAccessProvider(factory);

            var factoryRegistration = new SingletonRegistration <IMongoFactory>(factory);
            var mongoDataAccessProviderRegistration = new SingletonRegistration <IMongoDataAccessProvider>(dataAccessProvider);
            var dataAccessProviderRegistration      = new SingletonRegistration <IDataAccessProvider>(dataAccessProvider);

            ConfigurationResolver.AddRegistration(factoryRegistration);
            ConfigurationResolver.AddRegistration(mongoDataAccessProviderRegistration);
            ConfigurationResolver.AddRegistration(dataAccessProviderRegistration);
        }
예제 #31
0
        public static void Load()
        {
            LastCharacters = new List <LastCharacterInfo>();

            if (!File.Exists(_lastCharacterFile))
            {
                ConfigurationResolver.Save(LastCharacters, _lastCharacterFile);
            }

            LastCharacters = ConfigurationResolver.Load <List <LastCharacterInfo> >(_lastCharacterFile);

            // safety check
            if (LastCharacters == null)
            {
                LastCharacters = new List <LastCharacterInfo>();
            }
        }
예제 #32
0
        public AbstractService(Context glassContext)
        {


            GlassContext = glassContext;
            if (GlassContext == null) 
                throw new NullReferenceException("Context is null");

            var objectConstructionTasks = glassContext.DependencyResolver.ResolveAll<IObjectConstructionTask>();
            _objectConstruction = new ObjectConstruction(objectConstructionTasks); 

            var configurationResolverTasks = glassContext.DependencyResolver.ResolveAll<IConfigurationResolverTask>();
            _configurationResolver = new ConfigurationResolver(configurationResolverTasks);

            var objectSavingTasks = glassContext.DependencyResolver.ResolveAll<IObjectSavingTask>();
            _objectSaving = new ObjectSaving(objectSavingTasks);

            Profiler = new NullProfiler();

        }
예제 #33
0
파일: User.cs 프로젝트: JPVenson/DataAccess
		public static void Config(ConfigurationResolver<ConfigLessUserInplaceConfig> configBase)
		{
			configBase.SetClassAttribute(new ForModelAttribute(UsersMeta.TableName));
			configBase.SetPrimaryKey(e => e.PropertyA);
			configBase.SetForModelKey(e => e.PropertyA, UsersMeta.PrimaryKeyName);
			configBase.SetForModelKey(e => e.PropertyB, UsersMeta.ContentName);
		}
예제 #34
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractService"/> class.
        /// </summary>
        /// <param name="glassContext">The glass context.</param>
        /// <exception cref="System.NullReferenceException">Context is null</exception>
        protected AbstractService(Context glassContext)
        {

            GlassContext = glassContext;
            if (GlassContext == null) 
                throw new NullReferenceException("Context is null");

            var objectConstructionTasks = glassContext.DependencyResolver.ObjectConstructionFactory.GetItems();
            _objectConstruction = new ObjectConstruction(objectConstructionTasks); 

            var configurationResolverTasks = glassContext.DependencyResolver.ConfigurationResolverFactory.GetItems();
            _configurationResolver = new ConfigurationResolver(configurationResolverTasks);

            var objectSavingTasks = glassContext.DependencyResolver.ObjectSavingFactory.GetItems();
            _objectSaving = new ObjectSaving(objectSavingTasks);

            Profiler = new NullProfiler();

            Initiate(glassContext.DependencyResolver);
        }
예제 #35
0
 public WechatCustomApi(ICacheProvider cacheProvider) {
     _cacheProvider = cacheProvider;
     var root = HttpRuntime.AppDomainId == null ? AppDomain.CurrentDomain.BaseDirectory : HttpRuntime.AppDomainAppPath;
     var configurationResolver = new ConfigurationResolver(Path.Combine(root, "Storage.config"));
     _configSection = configurationResolver.Read<WechatConfigurationSection>("WechatMPConfigurationSection");
 }
예제 #36
0
 public CacheProviderFactory() {
     var root = HttpRuntime.AppDomainId == null ? AppDomain.CurrentDomain.BaseDirectory : HttpRuntime.AppDomainAppPath;
     _configurationResolver = new ConfigurationResolver(Path.Combine(root, "Web.config"));
 }
예제 #37
0
		static partial void BeforeConfig(ConfigurationResolver<Users> config);
예제 #38
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_configurationResolver != null)
                {
                    _configurationResolver.Dispose();
                }
                if (_objectConstruction != null)
                {
                    _objectConstruction.Dispose();
                }
                if (_objectSaving != null)
                {
                    _objectSaving.Dispose();
                }

                _configurationResolver = null;
                _objectConstruction = null;
                _objectSaving = null;

            }
        }
예제 #39
0
		static partial void AfterConfig(ConfigurationResolver<Users> config);