I have a model that looks like this:
public interface IEntity
{
int Id { get; set; }
}
Then the idea is to have my entities inherit from this interface:
public class User : IEntity
{
public int Id { get; set; }
}
However, one of my entities actually has a Guid as an identifier.
public class UserSession
{
public Guid Id { get; set; }
}
I really would like all my entities inheriting from the same interface but that would force me to add an integer based identity column to the UserSession which is unnecessary since Guid is the identity, but it would keep the domain model nice since all entities would inherit from the same base.
What options do I have in this scenario? Can I have two base interfaces, one for int and one for Guid? Should I add an identity column into the UserSession entity although it is unnecessary? I need the Guid so I can't just get rid of it and replace it with and integer.
Any thoughts on best practices?