示例#1
0
        private static IEmployeeService CreateService()
        {
            var customerId = 1;


            var factory = new PersonalLegacyContextFactoryBuilder()
                          .SetConnectionstringFormat("Data Source=localhost;Initial Catalog=SticosPersonalKunde_{0};Integrated Security=True;")
                          .WithCurrentCustomerId(customerId)
                          .Build();

            var commonfactory = new PersonalCommonLegacyContextFactoryBuilder()
                                .SetConnectionstringFormat("Data Source=localhost;Initial Catalog=SticosPersonalFelles;Integrated Security=True;")
                                .Build();

            var repository = new EmployeeLegacyDbEfRepositoryBuilder()
                             .WithDbFactory(factory)
                             .WithDbCommonFactory(commonfactory)
                             .Build();

            var controller = new EmployeeServiceBuilder()
                             .WithRepository(repository)
                             .Build();

            return(controller);
        }
示例#2
0
        private static IUnitRepository CreateRepository()
        {
            var customerId = 125134;

            var factory = new PersonalLegacyContextFactoryBuilder()
                          //.SetConnectionstringFormat("Data source=\.;Initial Catalog=SticosPersonalKunde_{0};User ID=sa;Password=xxx!")
                          .WithCurrentCustomerId(customerId)
                          .Build();

            var repository = new UnitCompanyLegacyDbEfRepositoryBuilder()
                             .WithMapper(AutoMapperSetup.Config.CreateMapper())
                             .WithDbFactory(factory)
                             .Build();

            return(repository);
        }
示例#3
0
        private static IUnitService CreateUnitService()
        {
            var customerId = 1;

            var factory = new PersonalLegacyContextFactoryBuilder()
                          .SetConnectionstringFormat("Data Source=.;Initial Catalog=SticosPersonalKunde_{0};Integrated Security=True;")
                          .WithCurrentCustomerId(customerId)
                          .Build();

            var repository = new UnitCompanyLegacyDbEfRepositoryBuilder()
                             .WithMapper(AutoMapperSetup.Config.CreateMapper())
                             .WithDbFactory(factory)
                             .Build();

            var controller = new UnitServiceBuilder()
                             .WithCompanyRepository(repository)
                             .Build();

            return(controller);
        }