private string DeObfuscateStringId(Type resourceType, string stringId) { IIdentifiable tempResource = _resourceFactory.CreateInstance(resourceType); tempResource.StringId = stringId; return(tempResource.GetTypedId().ToString()); }
public override Task <IIdentifiable> OnSetToOneRelationshipAsync(DomainUser user, HasOneAttribute hasOneRelationship, IIdentifiable rightResourceId, OperationKind operationKind, CancellationToken cancellationToken) { _hitCounter.TrackInvocation <DomainUser>(ResourceDefinitionHitCounter.ExtensibilityPoint.OnSetToOneRelationshipAsync); if (hasOneRelationship.Property.Name == nameof(DomainUser.Group)) { var afterGroupId = (Guid?)rightResourceId?.GetTypedId(); IMessageContent content = null; if (user.Group != null && afterGroupId == null) { content = new UserRemovedFromGroupContent { UserId = user.Id, GroupId = user.Group.Id }; } else if (user.Group == null && afterGroupId != null) { content = new UserAddedToGroupContent { UserId = user.Id, GroupId = afterGroupId.Value }; } else if (user.Group != null && afterGroupId != null && user.Group.Id != afterGroupId) { content = new UserMovedToGroupContent { UserId = user.Id, BeforeGroupId = user.Group.Id, AfterGroupId = afterGroupId.Value }; } if (content != null) { var message = OutgoingMessage.CreateFromContent(content); _pendingMessages.Add(message); } } return(Task.FromResult(rightResourceId)); }