views:

36

answers:

2

Should I use Entities that are created by the Entity Framework in my code when I don't actually have any data based requirements. The example I am dealing with this is as follows;

Users logs in. I look for their user account using Linq to Entity. I store the whole entity object in session. On the next page I load, from session, the authenticated user object once more for reasons on the page.

Should you do this or should I write my own object and move the properties over to it on the original sign in?

Many Thanks

+1  A: 

Storing the whole object in session raises some red flags. That model does not scale very well, and it means your not using the built in providers.

If possible, try using the membership, role and profile providers in your application. You will great simplify managing user authentication, authorization and preferences.

Tim Hoolihan
+1  A: 

I think the best approach is write your own objects and create a middle layer to create them. Also, write some tests to make sure that the object is being created correctly. So if something changes, you will know.

nandokakimoto