// This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            //SQL Database Connection (name defined in appsettings.json)
            var sqlConnectionConfig = new SqlConnectionConfig(Configuration.GetConnectionString("DefaultConnection"));

            services.AddSingleton(sqlConnectionConfig);
            services.AddScoped <IVideoService, VideoService>();

            //Optional for debugging
            services.AddServerSideBlazor(opts => opts.DetailedErrors = true);
            services.AddRazorPages();
            services.AddServerSideBlazor();
            services.AddSingleton <WeatherForecastService>();
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddRazorPages();
            //Debugging
            services.AddServerSideBlazor(o => o.DetailedErrors = true);

            //Session
            services.AddBlazoredSessionStorage();

            //Services
            services.AddScoped <ICustomerService, CustomerService>();
            services.AddScoped <IProductService, ProductService>();
            services.AddScoped <ICreditCardService, CreditCardService>();
            services.AddScoped <IOrderService, OrderService>();

            // SQL database connection [define in appsettings.json]
            var SqlConnectionConfig = new SqlConnectionConfig(Configuration.GetConnectionString("DefaultConnection"));

            services.AddSingleton(SqlConnectionConfig);
        }
Exemple #3
0
 public OrderService(SqlConnectionConfig connectionConfig)
 {
     _connectionConfig = connectionConfig;
 }
Exemple #4
0
 public CreditCardService(SqlConnectionConfig connectionConfig)
 {
     _connectionConfig = connectionConfig;
 }