Question

I'm new in MVC 5. When I create MVC 5 project. There is a simple Bootstrap website. And on this sample website, create an account. The program created these tables for me on my DB.

enter image description here

And when I control this tables data type. All id column's data type is NVARCHAR(128) for GUID. But i want to convert this field to int.

I try change some codes (IdentityUser class, etc.), but these in Microsoft's Dll. So I can't change.

How can i change all string id columns, string to id in MVC Solution? When I create new account on website, automatically must be give int userId not GUID. And also the other tables (Roles,UserRoles) must be have int id.

Thanks.

Was it helpful?

Solution

Basically you have to :

-Change the type of the key to int in the Identity user class
-Add customized Identity classes that use int as key
-Change the context class and user manager to use int as key
-Change start-up configuration to use int as key
-Change the AccountController to pass int as key

here a link where all steps are explained to achieve this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top