示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddApplicationInsightsTelemetry(Configuration);
            services.AddDistributedMemoryCache();

            services.AddSession(options =>
            {
                // Set a short timeout for easy testing.
                options.IdleTimeout    = TimeSpan.FromSeconds(10);
                options.CookieHttpOnly = true;
            });

            services.AddDbContext <DataContext>(options =>
                                                options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddMvc();

            MapperInitializer.Configure();

            services.AddTransient <IApplicationUnitOfWork, ApplicationUnitOfWork>();
            services.AddTransient <IUserAccountManager, UserAccountManager>();
            services.AddTransient <ICashAccountManager, CashAccountManager>();
            services.AddTransient <IClientManager, ClientManager>();
            services.AddTransient <ITransferTransactionManager, TransferTransactionManager>();
        }