Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            ServicesContainer.AddServices(services);

            MySQLServiceDBConfiguration.SetConnectionString(Configuration.GetSection("ConnectionString").GetSection("MySQL").Value).SetAssembly(typeof(GQ_Usuarios).Assembly).SetOption((builder) =>
            {
                return(builder);
            });

            SecurityConfigure.Configure(
                TimeSpan.FromDays(1),
                SecurityJWT.UsuarioLogueado <GQ_Usuarios>,
                WebNetCore.com.gq.security.Security.hasPermission,
                new Type[] { typeof(LoginController) });

            System.Web.HttpContext.Configure();

            //services.AddLocalization(options => options.ResourcesPath = "Resources");

            services.AddMvc();
            ///// Esto es para el Idioma
            //.AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix)
            //    .AddDataAnnotationsLocalization()
            //    .AddRazorOptions(options =>
            //    {
            //        var previous = options.CompilationCallback;
            //        options.CompilationCallback = context =>
            //        {
            //            previous?.Invoke(context);
            //            context.Compilation = context.Compilation.AddReferences(MetadataReference.CreateFromFile(typeof(UtilHelper).Assembly.Location));
            //        };
            //    });

            return(ServicesContainer.BuildServiceProvider());
        }
Exemplo n.º 2
0
        public void IniciarMongo()
        {
            BsonDefaults.GuidRepresentation = GuidRepresentation.Standard;

            IHostingEnvironment Environment = new HostingEnvironment();

            ServicesContainer.AddHostingEnvironment(Environment);

            var Configuration = ServicesContainer.ConfigurationBuilder();

            ServicesContainer.AddServices(new Microsoft.Extensions.DependencyInjection.ServiceCollection());

            MongoDbServices.Configure(new MongoDbConfig {
                ConnectionString = "mongodb://*****:*****@draromas.documents.azure.com:10255/?ssl=true&replicaSet=globaldb&connectTimeoutMS=120000&socketTimeoutMS=120000&waitQueueTimeoutMS=120000&maxIdleTimeMS=600000", DBName = "IOTServices"
            });
            //MongoDbServices.Configure(new MongoDbConfig { ConnectionString = "mongodb://*****:*****@gq-test2.cloudapp.net:27017/IOTServices?connectTimeoutMS=120000&socketTimeoutMS=120000&waitQueueTimeoutMS=120000&maxIdleTimeMS=600000&authMechanism=SCRAM-SHA-1", DBName = "IOTServices" });

            ServicesContainer.BuildServiceProvider();
        }
Exemplo n.º 3
0
        public void TestConection()
        {
            IHostingEnvironment Environment = new HostingEnvironment();

            ServicesContainer.AddHostingEnvironment(Environment);

            var Configuration = ServicesContainer.ConfigurationBuilder();

            ServicesContainer.AddServices(new Microsoft.Extensions.DependencyInjection.ServiceCollection());

            OracleServiceDBConfiguration.SetConnectionString("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.246.6.109)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=qhom11)));User Id=trz;Password=trz;")
            .SetAssembly(typeof(GQ_Usuarios).Assembly).SetOption((builder) =>
            {
                builder.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
                return(builder);
            });

            var service = ServicesContainer.BuildServiceProvider();

            using (var scope = service.GetRequiredService <IServiceScopeFactory>().CreateScope())
            {
                scope.ServiceProvider.GetService <OracleService>().Migrate();
            }
        }