コード例 #1
0
        public static CreationResult <User> Create(UserCreateCommand command)
        {
            if (command.Name.Length > 4)
            {
                var newGuid = Guid.NewGuid();
                var user    = new User(newGuid, command);
                return(CreationResult <User> .OkResult(new List <DomainEventBase> {
                    new UserCreateEvent(user, newGuid)
                },
                                                       user));
            }

            return(CreationResult <User> .ErrorResult(new List <string> {
                "Name too short"
            }));
        }