예제 #1
0
파일: Space.cs 프로젝트: linwenda/Funzone
    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);
    }