How to set up identity framework database on SQL server - c#

I am starting to look at the entity framework and especially identity. I am making an API to be used by an ASP.NET website. The problem I am having is I am used to the aspnet_regsql exe that is used by ASP.NET membership. I need to setup my application database so it has the correct tables and procedures for identity but I just cannot find out how too. I can then use the tables to link to my application tables.
So in short how can i setup the identity framework on a SQL server database?
Thanks in advance.

Check out this project: ASP.NET Identity Database (project template), it can help to create and customize ASP.NET Identity Database manually with SSDT.

Related

Implement new IdentityServer in .NetCore MVC with existing UserDb

I would like to create a new IdentityServer4 for a .NetCore MVC Project without ASP-Authentication, which gets the users from an existing MS SQL-database.
The user database should not have to be changed, if not necessary.
Unfortunately, previous tutorials could not help me, because a lot has been revised.
What steps are necessary to achieve this?
Hope you can help me,
best regards
The Identity server i am currently working on used to connect to a MsSQL server database that contained legacy users. The identity server itself stored its own tables in its database. I believe the way it worked was it had its on UserDbContext added to the middelwere.
So what we had was.
Identity server database - clients and stuff
Legacy user database - All user data.
Which is close to what you are talking about
services.AddDbContext<UserDbContext>(builder => builder.UseSqlServer(settingsSetup.ConnectionStrings.UserDatabaseConnection));
Everything ran though a custom UserManager.
It no longer runs this way as over the summer i integrated all of the users to Asp .net core identity and the data now resides in the same database as the identity server.
I can dig around in the solution control old branches if you need more info.

ASP.NET Core 2.0 Using old ASP.NET 2.0 database structure for authentication

So I've been developing an ASP.NET Core 2.0 application for a while now and I was wondering if it's possible to use an older SQL database with the following tables in my ASP.NET Core 2.0 application.
As I read online this is the default database structure for using ASP.NET 2.0 SqlMemebershipProvider classes. Is it possible to implement this into my application and if so, how should I approach this?
The structure you talk about is called ASP.NET Membership and it works for any ASP.NET version, up to 4.5.
There's no built-in way to run Membership in ASP.NET Core because Membership has been dead for many years. You have two paths to follow:
Move to ASP.NET Identity, works for both ASP.NET 4.x and Core. You will need to migrate your data manually.
Create the classes to consume the data manually. Notice that you won't have any of the security features of Membership so I strongly discourage this.
Of course, a 3rd path would be to keep using the outdated Membership on an ASP.NET MVC 5 application.
The old table structure is not compatible with ASP.NET Identity. Plain and simple. Your best path forward is to generate the tables that Identity does use, and then migrate the data from the old tables to those. Nothing else will work.

ASP.NET Identity using Peta Poco

I am starting to learn the ASP.NET Identity framework which we will include in our project as a replacement for our current ASP.NET MembershipProvider.
We use a SQL Server database and Peta Poco as our micro-orm, and we use the database first approach. We have a Users table which contains username, email, password, ...
I read that ASP.NET Identity uses the Code first approach together with Entity Framework.
How can we implement this framework in our project? Or is this not possible unless we use EF?

How to add external SQL Server database to an ASP.NET MVC application (c#)

I want to add external SQL Server database to my ASP.NET MVC application (C#).
For the project for which I am working, I have to use external SQL Server database instead of using built-in local database.
Can anyone help me? Thanks in advance.
Either add Entity Framework to your solution or look up how to work with System.Data.SqlClient.SqlCommand. You'll likely end up using both as both have it's advantages.
In your project/solution add an ADO.Net Entity Model.

How to use the same DB for authentication and data in MVC3?

Using MVC3, VS 2010 and SQL Express, I have been successful getting through a few tutorials. What I'd like to do now is build my own app which will be deployed. Using Code First, I'd like to have my user authentication and data reside in the same database. From what I've read, it is possible, (acceptable?) but so far I have not found any info on how to get my models and membership to map to the same database - I would like to specify a different DB than aspnet.mdf.
For the membership tables you can use the aspnet_regsql.exe tool on the command line.
Specify the database and credentials and it will create the membership tables on that database.
You can point the Entity Framework to the same database.
This way, both membership and EF will be living in the same database.

Categories

Resources