Exemple #1
0
        public void Migrate()
        {
            var claims = SourceDbContext.CharacterClaims.ToList();

            foreach (var claim in claims)
            {
                var newClaim = new GameCharacterClaim()
                {
                    Id              = _gameCharacterClaimKeyMapper.MapKey(claim.Id),
                    FromTime        = claim.FromTime,
                    EndTime         = claim.EndTime,
                    UserId          = _userKeyMapper.MapKey(claim.AccountId),
                    GameCharacterId = _gameCharacterKeyMapper.MapKey(claim.CharacterId)
                };

                TargetDbContext.GameCharacterClaims.Add(newClaim);
            }

            TargetDbContext.SaveChanges();
        }
        public void Migrate()
        {
            var playsRoles = SourceDbContext.PlaysRoles.ToList();

            foreach (var playsRole in playsRoles)
            {
                var newEntity = new PlaysGameRole()
                {
                    Id                   = _playsGameRoleKeyMapper.MapKey(playsRole.Id),
                    FromTime             = playsRole.FromTime,
                    EndTime              = playsRole.EndTime,
                    GameRole             = StringToGameRole.Convert(playsRole.Role),
                    GameCharacterClaimId = _gameCharacterClaimKeyMapper.MapKey(playsRole.CharacterClaimId)
                };

                TargetDbContext.PlaysGameRoles.Add(newEntity);
            }

            TargetDbContext.SaveChanges();
        }
        public void Migrate()
        {
            var characterClaimVersions = SourceDbContext.CharacterClaimVersions.ToList();

            foreach (var characterClaimVersion in characterClaimVersions)
            {
                var newClaim = new GameCharacterClaimVersion()
                {
                    Id                   = _gameCharacterClaimVersionKeyMapper.MapKey(characterClaimVersion.Id),
                    FromTime             = characterClaimVersion.FromTime,
                    EndTime              = characterClaimVersion.EndTime,
                    Comment              = characterClaimVersion.Comment,
                    IsRaider             = characterClaimVersion.Raider,
                    GameCharacterClaimId = _gameCharacterClaimKeyMapper.MapKey(characterClaimVersion.CharacterClaimId)
                };

                TargetDbContext.GameCharacterClaimVersions.Add(newClaim);
            }

            TargetDbContext.SaveChanges();
        }