Update 01/22/12:

Version 2.0 Beta completed working version of the providers source code can be found at its github location along with documentation for the new configuration options, and basic examples: http://github.com/holyprin/Holyprin.Web.Security

Requested features have been implemented (Centralized Configuration, Configurable key columns (Guid, Int32, Int64, Int16)).

I'll be adding the nuget package as soon as I get time.

Project Description

Code-First Membership / Role Provider is built using Entity Framework Code-First. Unlike others this project provides basic library abstraction (the code is not required to be in the DbContext project, only referenced by it).

Initial release of source code + sample project.

NuGet Package: http://nuget.org/List/Packages/Holyprin.Web.Security

Special Thanks

Michal Altair Valášek (Altairis) - I used his configuration extension methods and modified his HMAC512 VerifyPassword() method.

Usage

  • Create the 2 entity objects you wish to inject (User / Role)
  • Inherit the entities from IUser / IRole from the Holyprin.Web.Security namespace
  • open web.config and modify memberships (type="Holyprin.Web.Security.CFMembershipProvider, Holyprin.Web.Security", and type="Holyprin.Web.Security.CFRoleProvider, Holyprin.Web.Security")
  • Add to both memberships:
    • dbContext="Namespace.DbContext, Assembly.Name"
    • userObject="Namespace.User.Entity, Assembly.Name"
    • roleObject="Namespace.Role.Entity, Assembly.Name"
  • Run the application (make sure you have a DBInitializer set)

See the web project for a working example.

I will update documentation as soon as I get the time. For now the source code / nuget package pretty much explain most of it.

If you like the project please help a girl out and Donate anything is greatly appreciated.

Last edited Jan 22, 2012 at 7:00 AM by Holyprin, version 24