Пример #1
0
        /// <summary>
        /// Инициализировать контекст.
        /// </summary>
        /// <param name="serviceProvider">Поставщик сервисов.</param>
        /// <param name="environment">Окружение.</param>
        public virtual void InitContext(IServiceProvider serviceProvider, CoreBaseEnvironment environment)
        {
            CoreBase?.InitContext(new CoreBaseExternals
            {
                ResourceConvertingLocalizer = GetLocalizer <CoreBaseResourceConverting>(serviceProvider),
                ResourceErrorsLocalizer     = GetLocalizer <CoreBaseResourceErrors>(serviceProvider)
            });

            DataEntitySqlServer?.InitContext(new DataEntitySqlServerExternals
            {
                DataBaseSettings = DataBase?.Context.Settings,
                Environment      = environment
            });

            DataEntity?.InitContext(new DataEntityExternals
            {
                CoreBaseResourceErrors = CoreBase?.Context.Resources.Errors,
                DataEntityDbFactory    = DataEntitySqlServer?.Context.DbFactory
            });

            HostBase?.InitContext(new HostBaseExternals
            {
                PartAuth = new HostBasePartAuthExternals
                {
                    CoreBaseResourceErrors     = CoreBase?.Context.Resources.Errors,
                    ResourceErrorsLocalizer    = GetLocalizer <HostBasePartAuthResourceErrors>(serviceProvider),
                    ResourceSuccessesLocalizer = GetLocalizer <HostBasePartAuthResourceSuccesses>(serviceProvider)
                },
                PartLdap = new HostBasePartLdapExternals
                {
                    CoreBaseResourceErrors     = CoreBase?.Context.Resources.Errors,
                    ResourceErrorsLocalizer    = GetLocalizer <HostBasePartLdapResourceErrors>(serviceProvider),
                    ResourceSuccessesLocalizer = GetLocalizer <HostBasePartLdapResourceSuccesses>(serviceProvider)
                }
            });
        }