Let's say I have a class:
public class Person
{
public string Name{get;set;}
public string Email {get;set;}
public string GoogleId {get;set;}
public string FacebookId {get;set;}
}
If I want to make the email unique I will use the unique constraint bundle.
But I want to make both the googleId and the facebookId properties as a single unique constraint side by side with the email constraint (while non of them is the id). Is it possible?
Use the UniqueConstraints bundle:
Just make sure you update
GoogleAndFacebookIds
everytime you update eitherGoogleId
orFacebookId
. I was doing this so much I ended up using a simple interface on all my classes that did this sort of thing:So,