Compuskills-Jerusalem / mens-capstone-2020

1 stars 0 forks source link

#63 UserIdentity extention #63

Closed nossondsimon closed 4 years ago

nossondsimon commented 4 years ago

I wanted to be able to get data stored in the database and display it on the webpage to the user. This involved creating a new extender method in identityconfig. Also creating a Capstone2020User class, then replacing some instances of ApplicationUser and most instances of IdentityDbContext with Capstone2020User and Captsone2020Context respectively. If done improperly, and not using the proper scaffolding, the inheritance of Capstone2020User will get messed up and you will end up having issues with the ASP.NET created " discriminator" column. Therefore the extension is located in identityconfig and not in its own file, and inherited directly from identity instead of from applicationUser which inherits from Capstone2020User.

In order to extend the Identity table of AspNetUSers (where the user info is stored), I had to create the user class and then have it inherit from IdentityUser. There I added on FirstName, LastName, and AccountCreated.

Careful to store the database parameters in DataSource and not MVP.

The current manifestation of my goal is that now in the partial login view, the user's first name (which was input at account registration) is now how they are greeted. "Hello " will replace the original "Hello

I also set up some of the schema for the database in the UserGoals table and some of the preliminary logic for the bitmask I plan to use for the goal recurrence system.