コード例 #1
0
        public void Migrate()
        {
            var forRoles = SourceDbContext.ForRoles.ToList();

            foreach (var forRole in forRoles)
            {
                var newEntity = new SignedForGameRole()
                {
                    Id       = _signedForGameRoleKeyMapper.MapKey(forRole.Id),
                    GameRole = StringToGameRole.Convert(forRole.Role),
                    SignUpId = _signUpKeyMapper.MapKey(forRole.SignUpId)
                };

                TargetDbContext.SignedForGameRoles.Add(newEntity);
            }

            TargetDbContext.SaveChanges();
        }
コード例 #2
0
        public void Migrate()
        {
            var signUps = SourceDbContext.SignUps.ToList();

            foreach (var signUp in signUps)
            {
                var newEntity = new SignUp()
                {
                    Id      = _signUpKeyMapper.MapKey(signUp.Id),
                    Type    = StringToSignUpType.Convert(signUp.Type),
                    EventId = _eventKeyMapper.MapKey(signUp.EventId),
                    UserId  = _userKeyMapper.MapKey(signUp.AccountId)
                };

                TargetDbContext.SignUps.Add(newEntity);
            }

            TargetDbContext.SaveChanges();
        }