MVC4 app - how to remove Entity Framework and implement SimpleMembershipProvider?

Max

I am trying to use ASP.NET MVC4 to manage Forms Authentication and OAuth (Facebook), and take care of the browser sessions.

Yet I would like to manage all the users's data (and actually all the data) in a NoSQL data store. Since I already have a Data Access Layer library for that store, I thought I should not use Entity Framework at all.

My thought was: 1. Disable EntityFramework, all "default" data connections and tables used to implement "Membership". 2. Implement my own provider on top of NoSQL, by inheriting my own provider class from SimpleMembershipProvider (to support both Forms and OAuth authentication) 3. Configure system not to use Roles provider for now (no requirements to manage roles yet)

Unfortunately, I wasn't able to do "Step 1", i.e. get read from all the default connections and tables.

I did manage to register and use my own SimpleMembershipProvider implementation, but there is some code around that keeps calling the "default connection".

Example of exception I am getting with my provider, when disabling RoleManager in the web.config:

  InnerException: System.InvalidOperationException
       HResult=-2146233079
       Message=The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588
       Source=MvcApplication5
       StackTrace:
            at MvcApplication5.Filters.InitializeSimpleMembershipAttribute.SimpleMembershipInitializer..ctor() in c:\Users\max\Documents\Visual Studio 2012\Projects\MvcApplication2\MvcApplication5\Filters\InitializeSimpleMembershipAttribute.cs:line 45
       InnerException: System.Configuration.Provider.ProviderException
            HResult=-2146233088
            Message=The Role Manager feature has not been enabled.
            Source=System.Web
            StackTrace:
                 at System.Web.Security.Roles.EnsureEnabled()
                 at System.Web.Security.Roles.get_Provider()
                 at WebMatrix.WebData.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
                 at WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables)
                 at MvcApplication5.Filters.InitializeSimpleMembershipAttribute.SimpleMembershipInitializer..ctor() in c:\Users\max\Documents\Visual Studio 2012\Projects\MvcApplication2\MvcApplication5\Filters\InitializeSimpleMembershipAttribute.cs:line 41
            InnerException: 

What's the recommended way of doing that? (in web.config?) If there is a fundamental flaw or misunderstanding in my plan, please let me know.

Thanks for any hint.

Win

SimpleMembershipProvider doesn't use Entity Framework. Instead, it has own SQL operations.

You can look at the source of SimpleMembershipProvider.cs

If you want to implement a custom provider (to support both Forms and OAuth authentication), you want to override ExtendedMembershipProvider by coping some codes from SimpleMembershipProvider.

enter image description here

Copied the image from - SimpleMembership, Membership Providers, Universal Providers and the new ASP.NET 4.5 Web Forms and ASP.NET MVC 4 templates

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to implement IEnumerator in MVC4 application with ViewModel

From Dev

Entity Framework profiler - ASP.NET MVC4 with EF 6 -Unable to determine the provider name

From Dev

Will Orchard CMS support MVC4 with Entity Framework

From Dev

How to mock method with ViewModel in MVC4 with Entity Framework 4.0

From Dev

Entity Framework T4: POCOs implement generic interface?

From Dev

How to configure automapper for Unity dependency injection and Entity Framework in MVC 5 / Web API 2.0 app?

From Dev

How to retrieve image from database without using Entity Framework in ASP.NET MVC4

From Dev

Log4net with Entity Framework 5 and MVC4

From Dev

How do I implement versioning with Entity Framework

From Dev

How can i create a Partial View for MVC4 or MVC 5 using Entity Framework (.edmx Model) with Razor Views?

From Dev

Entity Framework - how to remove linked elements

From Dev

how to implement datetimepicker in mvc4

From Dev

How to remove casting enum types in entity framework

From Dev

How to implement transient fault handling pattern with entity framework

From Dev

MVC4 Entity Framework Controller Database Issue

From Dev

PieChart in mvc4 from Entity Framework

From Dev

Unable to Use an HtmlHelper in Razor syntax in MVC4 Intranet App using Entity Framework

From Dev

How to mock method with ViewModel in MVC4 with Entity Framework 4.0

From Dev

How to implement Reset button for window bonded with Entity Framework?

From Dev

Entity Framework T4: POCOs implement generic interface?

From Dev

How to Implement Dependent Dropdownlist in MVC4 Razor

From Dev

MVC4 Entity Framework 6 Model State Validation Issues

From Dev

How to retrieve image from database without using Entity Framework in ASP.NET MVC4

From Dev

How to perform edit function in MVC4 without using entity framework?

From Dev

How to implement SQL where in for entity framework 6

From Dev

How to implement transient fault handling pattern with entity framework

From Dev

How to properly implement many to one structure in entity framework?

From Dev

Implement the Entity Framework in the Web API

From Dev

Dropdownlist and MVC4 Entity Framework

Related Related

  1. 1

    How to implement IEnumerator in MVC4 application with ViewModel

  2. 2

    Entity Framework profiler - ASP.NET MVC4 with EF 6 -Unable to determine the provider name

  3. 3

    Will Orchard CMS support MVC4 with Entity Framework

  4. 4

    How to mock method with ViewModel in MVC4 with Entity Framework 4.0

  5. 5

    Entity Framework T4: POCOs implement generic interface?

  6. 6

    How to configure automapper for Unity dependency injection and Entity Framework in MVC 5 / Web API 2.0 app?

  7. 7

    How to retrieve image from database without using Entity Framework in ASP.NET MVC4

  8. 8

    Log4net with Entity Framework 5 and MVC4

  9. 9

    How do I implement versioning with Entity Framework

  10. 10

    How can i create a Partial View for MVC4 or MVC 5 using Entity Framework (.edmx Model) with Razor Views?

  11. 11

    Entity Framework - how to remove linked elements

  12. 12

    how to implement datetimepicker in mvc4

  13. 13

    How to remove casting enum types in entity framework

  14. 14

    How to implement transient fault handling pattern with entity framework

  15. 15

    MVC4 Entity Framework Controller Database Issue

  16. 16

    PieChart in mvc4 from Entity Framework

  17. 17

    Unable to Use an HtmlHelper in Razor syntax in MVC4 Intranet App using Entity Framework

  18. 18

    How to mock method with ViewModel in MVC4 with Entity Framework 4.0

  19. 19

    How to implement Reset button for window bonded with Entity Framework?

  20. 20

    Entity Framework T4: POCOs implement generic interface?

  21. 21

    How to Implement Dependent Dropdownlist in MVC4 Razor

  22. 22

    MVC4 Entity Framework 6 Model State Validation Issues

  23. 23

    How to retrieve image from database without using Entity Framework in ASP.NET MVC4

  24. 24

    How to perform edit function in MVC4 without using entity framework?

  25. 25

    How to implement SQL where in for entity framework 6

  26. 26

    How to implement transient fault handling pattern with entity framework

  27. 27

    How to properly implement many to one structure in entity framework?

  28. 28

    Implement the Entity Framework in the Web API

  29. 29

    Dropdownlist and MVC4 Entity Framework

HotTag

Archive