Esempio n. 1
0
    public static Space Initialize(ISpaceChecker spaceValidatorService, Guid userId, string name,
                                   string backgroundImage, Visibility visibility)
    {
        if (!spaceValidatorService.IsUniqueNameInUserSpace(userId, name))
        {
            throw new SpaceNameAlreadyExistsException();
        }

        var space = new Space(Guid.NewGuid());

        space.ApplyChange(new SpaceCreatedEvent(space.Id, space.GetNextVersion(), userId, name, backgroundImage,
                                                visibility));

        return(space);
    }