I created an empty project (MVC) but now want user roles and profiles tables added to my db
Asked Answered
T

1

6

When you create an MVC Application with Windows Authentication, it adds roles and what not to your database tables... How do you add those in manually if you have created the project as an empty project?

I have run:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql.exe 

inside packagemanager but it has made the old versions

aspnet_blabla

.... Oh god, there's so many tables and views added (cries self to sleep)

I found http://msdn.microsoft.com/en-us/library/ms229862(v=vs.100).aspx#findingthecorrectversion which pretty much says the usual stuff that ends up placing the crazies in my database. :'(

is there anything wrong with using the aspnet_blabla tables?

Tomasine answered 16/12, 2013 at 20:44 Comment(2)
Create a brand new MVC application with the stuff you want and copy/paste it over?Sakovich
lol, this was my plan C and I'm already at that point... sighhhTomasine
V
2

There are three main implementations of membership (and roles) in the default Microsoft stack. In order of coolness (i.e. newest to oldest), they are:

ASP.NET Identity

This is the new coolness, released in tandem with VS2013. It is a simplified system implemented with EF Code First, and should be pretty easy to plug into any project. Here is a walkthrough of doing just that. All of the project templates in VS2013 use this.

Simple Membership

Is a light-weight implementation of the Membership Provider model (more below). As the original implementation was cumbersome, this tried to alleviate some of that. It is more compatible with older WebForms stuff. This was the best link I could find.

ASP.NET Membership Provider

This is the model that shipped with .NET 2.0 and has a gigantic schema. You can create the schema in your database with the aspnet_regsql tool.

Vasquez answered 17/12, 2013 at 3:52 Comment(2)
Cheers man, the top one is where it's at! Thank goodness the reversal procedure of the Membership Provider works well :DTomasine
I have read and tried many times to get ASP.Net Identity to create the database tables i'm wanting... but it just doesn't work. The schema says its missing, and then if I try add that schema I only have the old membership provider stuff?Tomasine

© 2022 - 2024 — McMap. All rights reserved.