Ejemplo n.º 1
0
        public AddressModelTests()
        {
            AutoMapperBootStrapper.CreateMapperConfiguration();
            IOptions <SiteDbContext> dataBaseConfig =
                new OptionsManager <SiteDbContext>(new IConfigureOptions <SiteDbContext> [0]);

            dataBaseConfig.Value.DefaultConnectionString =
                @"Data Source=haw.trustteam.be,41433; Initial Catalog=bocotransapp; Integrated Security=false;User ID =sa;Password=abit@complicated35; MultipleActiveResultSets=True";

            IUnitOfWork unitOfWork = new UnitOfWork(dataBaseConfig);

            _addressesService = new AddressesService(unitOfWork, null);
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // *If* you need access to generic IConfiguration this is **required**
            services.AddSingleton <IConfiguration>(Configuration);
            // Add framework services.
            services.Configure <SiteDbContext>(Configuration.GetSection("ConnectionString"));

            //// Add global exception filter, all error exceptions are caught in here
            var builder = services.AddMvc();

            builder.AddMvcOptions(o => { o.Filters.Add(new GlobalExceptionFilter(this.LoggerFactory)); });

            //// set DI
            AddDependencyInjection(services);

            AddPoliciesAuthorization(services);

            services.AddMemoryCache();

            services.AddAuthentication();

            //// initialize mapper
            AutoMapperBootStrapper.CreateMapperConfiguration();
        }