I'm doing some experiments, trying to model some stuff using Entity Framework, in purpose to eventually learn how to work with it and its many features...
Imagine having an entity in your application, which is your Application's User. The user can authenticate in several different methods (Using Email, Facebook, Twitter, etc.), I personally follow the following rules:
1. A User must have at least a single authentication method through which he is registered.
2. Multiple authentication methods can be applied to match the same user.
3. Each authentication method is stored separately along with its parameters.
4. Typically if we add a new authentication method to our app, we wouldn't like to change existing entities.
I have written a generic algorithms which register/authenticate a user using any authentication method, assuming an authentication entity which implements an interface (the only thing in common among all authentication method is the existence of a user identifier).
Now, I would like to do the same using EF. I want to create an set of entities, each entity holds the information required for the authentication to take place and connects the authenticating user to its profile. Of course that I could do it naively, and write way too much code.
What is the optimal way to do so using EF?
Thanks A Lot!