Example #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);
        }
Example #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/";
            });
        }
Example #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();
        }