ASP.NET Identity using Peta Poco - c#

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?

Related

Database encyption with Entity Framework Core/ASP.NET Core

I want to store encrypted data in the database. I am using the Entity Framework and ASP.NET Core MVC.
I read about DataProtection: services.AddDataProtection().ProtectKeysWithDpapi();
But when I am not mistaken, this is not intended to be used for persistent data, just for cookies and stuff.
Are there any ASP.NET Core services I can use to encrypt my database/entity data? Or some database encryption for Microsoft SQL Server that work well with EF Core?
Since querying encrypted data is also a performance and logic issue I would limit it to specific fields only in the database.

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.

How to set up identity framework database on SQL server

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.

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.

Using .Net Membership Provider in conjunction with Entity Framework 4.3 migrations

I'm working on an application where so far we have been managing the database and domain via Entity Framework 4.3 code first with migrations...
As seen here...
http://blogs.msdn.com/b/adonet/archive/2012/02/09/ef-4-3-code-based-migrations-walkthrough.aspx
We have come to the point of needing to implement membership and are wanting to use .NET Membership provider. In the past I have just used aspnet_regsql.exe to generate all the membership tables in the database. Is there a way to make it so these membership tables get generated in the database as part of one of the migrations?
Maybe you can use the class SqlServices to install the services:
http://msdn.microsoft.com/en-us/library/system.web.management.sqlservices.install.aspx
Example:
SqlServices.Install ("databaseName", SqlFeatures.Membership, yourConnectionString);
SqlServices.Install ("databaseName", SqlFeatures.RoleManager, yourConnectionString);
I hope I was helpful.

Categories

Resources