Customize ASP.NET Identity

Asked

Viewed 54 times

0

I still only use the FormsAuthentication but I’m looking to migrate to the ASP.NET Identity in MVC.

In my current projects, I don’t work with roles of FormsAuthentication, and yes by permission of access by controller and actions where I save this data in a session per logged-in user, for several reasons.

Currently when I log in, I use:

FormsAuthentication.SetAuthCookie('[email protected]', false);

In the blog of Eduardo Pires, has the article in this link which shows that we can use the ASP.NET Identitywith a custom nomenclature and shows that it is necessary to have all tables mapped used in the ASP.NET Identity.

My doubts are:

  • Can I map the tables using Data Annotations or I’ll have to use Fluent API?
  • As the current process is a normal registration, will with the ASP.NET Identity I can do the same process?

1 answer

0

According to this Answer from Stackoverflow in English Data Annotations has some limitations. All you can do with Data Annotations is possible with Fluent API not the other way around.

If you need something very specific like:

  • Deactivate cascade by deleting data in tables;
  • Specify primary key when not exposed in your data class;
  • Very specific cases of granulence in Tables relationships, especially when only one of the associations is exposed...

Then you must use Fluent API.

ASP.NET Identity is a new version of Membershipprovider (legacy) that uses Signinmanager and has many more features than the legacy.

I hope it helps you my answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.