Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hey,

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!
Posted

1 solution

You can start with some basic stuff for Entity Framework like here.[^] These tutorial will help you to build the required entities.

Also MSDN do have video tutorials here.[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900