Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            //Service Database
            services.AddDbContext <DBContext>(options =>
                                              options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            var serviceProvider = services.BuildServiceProvider();

            DBinitialize.INIT(serviceProvider);
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DBContext>(Options =>
                                              Options.UseSqlServer(Configuration.GetConnectionString("ConnectionStr")));
            services.AddMvc();
            var serviceProvider = services.BuildServiceProvider();

            DBinitialize.INIT(serviceProvider);

            services.AddSpaStaticFiles(c =>
            {
                c.RootPath = "ClientApp/dist/";
            });
        }
Exemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => true;
            });

            services.AddDbContext <NorthwindContext>(options => {
                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"));
            });
            var serviceProvider = services.BuildServiceProvider();

            DBinitialize.INIT(serviceProvider);


            services.AddControllersWithViews()
            .AddNewtonsoftJson();
            services.AddRazorPages();
        }