Click here to Skip to main content
15,886,019 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am starting a MVC5 app, and I want to use the identity functionality without Entity framework. Here are the specifics:

0) MVC5 (.Net 4.6n) with individual user authentication (either via a standard userid/pwd login, or with a common access card (CAC).

1) No external logins, such as facebook, google, twitter, etc

2) *All* database access is performed via stored procs

3) Because of #2 above, we want to use ADO instead of an EntityFramework, or any other ORM for that matter. ORMs have massive footprints in terms of memory and disk space compared to a handful of ADO methods, and we don't need an ORM to manage our tables for us.

What I have tried:

Google quite a bit but the landscape is quite cluttered with partial and nonsensical answers.
Posted
Updated 11-Feb-19 5:57am
Comments
Richard Deeming 12-Feb-19 10:31am    
Did you not have any luck adapting Mark Johnson's demo, then?
https://github.com/mark-j/DapperIdentityDemo[^]
#realJSOP 12-Feb-19 10:34am    
It's been a few days (maybe a week) since I looked at it, but it presented more questions.

For instance, do I need the OWIN stuff if I'm not allowing external logins (farcebook, bitter, evil, etc)?
Richard Deeming 12-Feb-19 10:38am    
Yes, unfortunately you do still need all the OWIN guff to make Identity work, even if you're only using local logins.

Introduction to ASP.NET Identity[^]:
"ASP.NET authentication is now based on OWIN middleware that can be used on any OWIN-based host. ASP.NET Identity does not have any dependency on System.Web. It is a fully compliant OWIN framework and can be used in any OWIN hosted application.
ASP.NET Identity uses OWIN Authentication for log-in/log-out of users in the web site. This means that instead of using FormsAuthentication to generate the cookie, the application uses OWIN CookieAuthentication to do that."
#realJSOP 12-Feb-19 10:46am    
I'll take another look then. I also don't recall whether or not he duscussed how to completely remove EF. I beleiev it's more involved than just uninstalling the nuget package.
Richard Deeming 12-Feb-19 10:52am    
Once you've removed the DbContext classes, you should just need to remove the EntityFramework.Identity and EntityFramework packages. Depending on how well it cleans up after itself, you might also need to remove the entityFramework element and config section from your web.config file.

1 solution

You just replace your EF calls with "ADO.NET calls".

You create a DAL (data access layer / repository) so you don't keep repeating (in code) the same calls.

Most of your "hi speed one way retrieval" will involve "Data Readers". You'll need POCO's (the equivalent of EF entities).

(And EF doesn't have a "massive" footprint. It only does if one does not know / care about "chunking" properly).
 
Share this answer
 
Comments
Didier M. 12-Nov-20 5:45am    
Please Do you have any example?
This approach is very interesting.

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