Ejemplo n.º 1
0
        public VillageService(PlayerRepository playerRepository, VillageRepository villageRepository, BuildingRepository buildingRepository, BuildingTypeRepository buildingTypeRepository, UnitRepository unitRepository, UnitTypeRepository unitTypeRepository, ProductRepository productRepository, ProductTypeRepository productTypeRepository, ResourceRepository resourceRepository, ResourceTypeRepository resourceTypeRepository, BuildingListQuery buildingListQuery, BuildingTypeListQuery buildingTypeListQuery, ProductListQuery productListQuery, ProductTypeListQuery productTypeListQuery, ResourceTypeListQuery resourceTypeListQuery, UnitTypeListQuery unitTypeListQuery, VillageListQuery villageListQuery, AdventureRepository adventureRepository, AdventureTypeRepository adventureTypeRepository, AdventureTypeListQuery adventureTypeListQuery, UnitListQuery unitListQuery)
        {
            this.playerRepository  = playerRepository;
            this.villageRepository = villageRepository;

            this.buildingRepository     = buildingRepository;
            this.buildingTypeRepository = buildingTypeRepository;

            this.unitRepository     = unitRepository;
            this.unitTypeRepository = unitTypeRepository;

            this.productRepository     = productRepository;
            this.productTypeRepository = productTypeRepository;

            this.resourceRepository     = resourceRepository;
            this.resourceTypeRepository = resourceTypeRepository;

            this.adventureRepository     = adventureRepository;
            this.adventureTypeRepository = adventureTypeRepository;


            this.buildingTypeListQuery = buildingTypeListQuery;

            this.productTypeListQuery = productTypeListQuery;
            this.productListQuery     = productListQuery;

            this.resourceTypeListQuery  = resourceTypeListQuery;
            this.unitTypeListQuery      = unitTypeListQuery;
            this.adventureTypeListQuery = adventureTypeListQuery;
            this.villageListQuery       = villageListQuery;
            this.unitListQuery          = unitListQuery;
        }
 public BuildingService(BuildingRepository buildingRepository, VillageRepository villageRepository, PlayerRepository playerRepository, ResourceRepository resourceRepository, BuildingListQuery buildingListQuery, ResourceListQuery resourceListQuery)
 {
     this.buildingRepository = buildingRepository;
     this.villageRepository  = villageRepository;
     this.playerRepository   = playerRepository;
     this.resourceRepository = resourceRepository;
     this.buildingListQuery  = buildingListQuery;
     this.resourceListQuery  = resourceListQuery;
 }
Ejemplo n.º 3
0
        public void TextDapperContext()
        {
            DbEntityMap.InitMapCfgs();
            IDapperContext dapperContext = new DapperContext(new NameValueCollection()
            {
                ["aa.dataSource.AaCenter.connectionString"] = "Data Source =.; Initial Catalog = AaCenter;User ID = sa; Password = lee2018;",
                ["aa.dataSource.AaCenter.provider"]         = "SqlServer"
            });
            IUserInfoRepository _userInforepository = new UserInfoRepository();
            IVillageRepository  villageRepository   = new VillageRepository();

            villageRepository.Insert(new Village {
                Id          = Guid.NewGuid(),
                VillageName = "aa",
                GmtCreate   = DateTime.Now,
                GmtModified = DateTime.Now
            });


            var model = villageRepository.Get(new Guid("6D880321-DB17-4B32-9F0A-CE9F3F25AA01"));

            model.VillageName = "bbb";
            villageRepository.Update(model);

            //var obj = _userInforepository.Insert(new UserInfo()
            //{
            //    RealName = "111",
            //    UserName = "******",
            //    GmtCreate=DateTime.Now,
            //    LastLoginDate=DateTime.Now,
            //    GmtModified=DateTime.Now
            //});
            var users    = _userInforepository.QueryAll();
            var userList = _userInforepository.From(sql =>
                                                    sql.Select()
                                                    .Where(p => p.RealName.Contains("成"))
                                                    .OrderBy(x => x.SysNo)
                                                    .Page(1, 20)
                                                    );

            var count = userList.ToList().Count();

            //动态where
            Expression <Func <UserInfo, bool> > expression = p => p.RealName == "成天";

            var where = DynamicWhereExpression.Init <UserInfo>();

            where = where.And(x => x.RealName == "成天");
            var dynamicUsers = _userInforepository.From(sql =>
                                                        sql.Select()
                                                        .Where(where)
                                                        .OrderBy(x => x.SysNo)
                                                        .Page(1, 20)
                                                        );
            var count2 = dynamicUsers.ToList().Count();
        }
Ejemplo n.º 4
0
 public WoodVolumeController(IWoodVolumeRepository woodVolumeRepository
                             , DivisionRepository divisionRepository
                             , DistrictRepository districtRepository
                             , RangeRepository rangeRepository
                             , TalukRepository talukRepository
                             , VillageRepository villageRepository)
 {
     _WoodVolumeRepository = woodVolumeRepository;
     _DivisionRepository   = divisionRepository;
     _DistrictRepository   = districtRepository;
     _RangeRepository      = rangeRepository;
     _TalukRepository      = talukRepository;
     _VillageRepository    = villageRepository;
 }
Ejemplo n.º 5
0
        public void TextDapperContextMul()
        {
            //TODO 主从 数据库使用下划线_作为分隔符
            DbEntityMap.InitMapCfgs();
            //init datasourse
            IDbDatasource dbDatasource = new DbDataSource();

            dbDatasource.Init(new NameValueCollection()
            {
                ["aa.dataSource.master_AaCenter.connectionString"] = "Data Source =.; Initial Catalog = AaCenter;User ID = sa; Password = db123;",
                ["aa.dataSource.master_AaCenter.provider"]         = "SqlServer"
            });

            dbDatasource.Init(new NameValueCollection()
            {
                ["aa.dataSource.slave_AaCenter.connectionString"] = "Data Source =.; Initial Catalog = AaCenterS1;User ID = sa; Password = db123;",
                ["aa.dataSource.slave_AaCenter.provider"]         = "SqlServer"
            });



            IDapperContext dapperContext = new DapperContext();


            IVillageRepository villageRepository = new VillageRepository(dapperContext);

            IUserInfoRepository userInfoRepository = new UserInfoRepository(dapperContext);

            DbContextHolder.SetDbSourceMode("slave");

            try
            {
                var user  = userInfoRepository.Count();
                var model = villageRepository.Get(new Guid("6D880321-DB17-4B32-9F0A-CE9F3F25AA01"));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
 public ProductService(ProductRepository productRepository, ProductTypeRepository productTypeRepository, ResourceRepository resourceRepository, ResourceTypeRepository resourceTypeRepository, VillageRepository villageRepository, ProductListQuery productListQuery, ResourceListQuery resourceListQuery, BuildingListQuery buildingListQuery)
 {
     this.productRepository  = productRepository;
     this.resourceRepository = resourceRepository;
     this.productListQuery   = productListQuery;
     this.resourceListQuery  = resourceListQuery;
     this.buildingListQuery  = buildingListQuery;
 }
Ejemplo n.º 7
0
        private readonly ProductListQuery productListQuery;   //na zaplatenie najst product

        public UnitService(UnitRepository unitRepository, UnitTypeRepository unitTypeRepository, VillageRepository villageRepository, ProductRepository productRepository, ProductTypeRepository productTypeRepository, UnitListQuery unitListQuery, ProductListQuery productListQuery)
        {
            this.unitRepository    = unitRepository;
            this.productRepository = productRepository;
            this.unitListQuery     = unitListQuery;
            this.productListQuery  = productListQuery;
        }
 public VillageService(VillageRepository villageRepository)
 {
     _villageRepository = villageRepository;
 }