In my business logic, A User
can be identified by his/her mobile phone number. 3rd party verification system ensures that the customer's phone number exists in real, and the system checks the uniqueness before insert User
record into the table. From my opinion, PhoneNumber
is already unique, so Id
is unnecessary.
Here is my current User
class. PhoneNumber
currently is a value object in User
class.
public class User : AggregateRoot<Guid>
{
public Guid Id {get; private set;}
public PhoneNumber PhoneNumber { get; private set; }
public Birthday Birthday { get; private set; }
public Gender Gender { get; private set; }
public Name Name { get; private set; }
}
I want to change like below.
public class User : AggregateRoot<string>
{
public string PhoneNumber { get; private set; }
public Birthday Birthday { get; private set; }
public Gender Gender { get; private set; }
public Name Name { get; private set; }
}
Are there any flaws if I use non-UUID Id in an Aggregate root or an Entity?