Exemplo n.º 1
0
 public GlobalizationConfig(
     string cultureName,
     LocalizationsEnum localization)
 {
     CultureInfo  = new CultureInfo(cultureName);
     Localization = localization;
 }
Exemplo n.º 2
0
 // Constructors
 public DefaultBootstrapper(
     IServiceCollection services,
     string tenantCode,
     string cultureName,
     LocalizationsEnum localization)
     : base(services, tenantCode, cultureName, localization)
 {
 }
Exemplo n.º 3
0
 public ImportInvoiceAppServiceTest(
     ITestOutputHelper output,
     string tenantCode              = "dev",
     string creationUser            = "******",
     LocalizationsEnum localization = LocalizationsEnum.Default,
     string cultureName             = "en-US"
     ) : base(output, tenantCode, creationUser, localization, cultureName)
 {
 }
Exemplo n.º 4
0
 protected TestBase(
     ITestOutputHelper output,
     string tenantCode              = "dev",
     string creationUser            = "******",
     LocalizationsEnum localization = LocalizationsEnum.Default,
     string cultureName             = "en-US")
     : base(output, tenantCode, creationUser, localization, cultureName)
 {
 }
Exemplo n.º 5
0
 public CustomerDomainServiceTest(
     ITestOutputHelper output,
     string tenant                  = "dev",
     string creationUser            = "******",
     LocalizationsEnum localization = LocalizationsEnum.Brazil,
     string cultureName             = "en-US")
     : base(output, tenant, creationUser, localization, cultureName)
 {
 }
Exemplo n.º 6
0
 public DefaultBootstrapper(
     string tenantCode,
     LocalizationsEnum localization,
     LanguageEnum uiLanguage,
     CultureInfo uiCultureInfo,
     CultureInfo cultureInfo,
     IServiceCollection serviceCollection = null
     ) : base(tenantCode, localization, uiLanguage, uiCultureInfo, cultureInfo, serviceCollection)
 {
 }
Exemplo n.º 7
0
 public GlobalizationInfo(
     LocalizationsEnum localization,
     LanguageEnum uiLanguage,
     CultureInfo uiCultureInfo,
     CultureInfo cultureInfo
     )
 {
     Localization  = localization;
     UILanguage    = uiLanguage;
     UICultureInfo = uiCultureInfo;
     CultureInfo   = cultureInfo;
 }
Exemplo n.º 8
0
        protected TestBase(
            ITestOutputHelper output,
            string tenantCode              = "dev",
            string creationUser            = "******",
            LocalizationsEnum localization = LocalizationsEnum.Default,
            string cultureName             = "en-US")
        {
            _output      = output;
            TenantCode   = tenantCode;
            CreationUser = creationUser;
            Localization = localization;
            CultureName  = cultureName;

            var service = new ServiceCollection();

            Bootstrapper = GetBootstrapper(service);
        }
Exemplo n.º 9
0
        // Constructors
        protected BootstrapperBase(
            string tenantCode,
            LocalizationsEnum localization,
            LanguageEnum uiLanguage,
            CultureInfo uiCultureInfo,
            CultureInfo cultureInfo,
            IServiceCollection serviceCollection = null
            )
        {
            TenantCode    = tenantCode;
            Localization  = localization;
            UILanguage    = uiLanguage;
            CultureInfo   = cultureInfo;
            UICultureInfo = uiCultureInfo;

            if (serviceCollection != null)
            {
                ServiceCollection = serviceCollection;
            }
            else
            {
                ServiceCollection = new ServiceCollection();
            }
        }
Exemplo n.º 10
0
        // Constructores
        protected BootstrapperBase(
            IServiceCollection services,
            string tenantCode,
            string cultureName,
            LocalizationsEnum localization)
        {
            _services = services;

            _tenantCode   = tenantCode;
            _cultureName  = cultureName;
            _localization = localization;

            var typeRegistrationCollection = new List <TypeRegistration>();

            typeRegistrationCollection.AddRange(GetTypeRegistrationCollection());
            _typeRegistrationCollection = typeRegistrationCollection.ToArray();

            if (_typeRegistrationCollection?.Any() == true)
            {
                foreach (var typeRegistration in _typeRegistrationCollection)
                {
                    if (typeRegistration.AbstractionType == null &&
                        typeRegistration.ConcreteType != null)
                    {
                        switch (typeRegistration.RegistrationLifeTime)
                        {
                        case Models.Enums.RegistrationLifeTimeEnum.Transient:
                            services.AddTransient(typeRegistration.ConcreteType);
                            break;

                        case Models.Enums.RegistrationLifeTimeEnum.Scoped:
                            services.AddScoped(typeRegistration.ConcreteType);
                            break;

                        case Models.Enums.RegistrationLifeTimeEnum.Singleton:
                            services.AddSingleton(typeRegistration.ConcreteType);
                            break;

                        default:
                            throw new ArgumentOutOfRangeException("Invalid RegistrationLifeTime");
                        }
                    }
                    else
                    {
                        switch (typeRegistration.RegistrationLifeTime)
                        {
                        case Models.Enums.RegistrationLifeTimeEnum.Transient:
                        {
                            if (typeRegistration.FactoryFunction == null)
                            {
                                services.AddTransient(typeRegistration.AbstractionType, typeRegistration.ConcreteType);
                            }
                            else
                            {
                                services.AddTransient(typeRegistration.AbstractionType, serviceProvider => {
                                        return(typeRegistration.FactoryFunction(serviceProvider));
                                    });
                            }
                            break;
                        }

                        case Models.Enums.RegistrationLifeTimeEnum.Scoped:
                        {
                            if (typeRegistration.FactoryFunction == null)
                            {
                                services.AddScoped(typeRegistration.AbstractionType, typeRegistration.ConcreteType);
                            }
                            else
                            {
                                services.AddScoped(typeRegistration.AbstractionType, serviceProvider => {
                                        return(typeRegistration.FactoryFunction(serviceProvider));
                                    });
                            }
                            break;
                        }

                        case Models.Enums.RegistrationLifeTimeEnum.Singleton:
                        {
                            if (typeRegistration.FactoryFunction == null)
                            {
                                services.AddSingleton(typeRegistration.AbstractionType, typeRegistration.ConcreteType);
                            }
                            else
                            {
                                services.AddSingleton(typeRegistration.AbstractionType, serviceProvider => {
                                        return(typeRegistration.FactoryFunction(serviceProvider));
                                    });
                            }
                            break;
                        }

                        default:
                            throw new ArgumentOutOfRangeException("Invalid RegistrationLifeTime");
                        }
                    }
                }
            }

            _serviceProvider = services.BuildServiceProvider();
        }