예제 #1
0
 protected static void SetObjectVersionIfNotExist(BaseCommandWithInitiator command, ObjectEntity originalEntity)
 {
     if (originalEntity.Version == null)
     {
         originalEntity.Version = new VersionInfoEntity(1, new UserInfoEntity(command.UserId, command.UserName, command.Email));
     }
 }
예제 #2
0
        protected async Task IncObjectVersion(BaseCommandWithInitiator command, ObjectEntity originalEntity, ObjectEntity newEntity, CancellationToken cancellationToken)
        {
            await _context.ObjectVersions.InsertOneAsync(originalEntity, cancellationToken : cancellationToken);

            newEntity.Version = new VersionInfoEntity(originalEntity.Version.VersionId + 1, new UserInfoEntity(command.UserId, command.UserName, command.Email));
        }