I have these entities:
public class User {
public string Username { get; set; }
// OtherProperties
}
public class Page {
public string Username { get; set; }
// OtherProperties
}
OtherProperties are completely different in each entity from another one. But, Usernames should be unique, no matter where they belong. I mean if there is a User with Username = a, none of other Users or Pages can have this Username. How would you handle this? Is it a good idea to have a 3th entity e.g. a
class Username { string Name { get; set; } }
considering this fact that it is just a simple-single property?
UPDATE: more explain:
User is a completely independent different entity from Page. But both of them have a property named Username which should be unique in entire application.