Saturday, November 9, 2013

In Visual Studio sql server object explorer connect to all sqlservers: compact, localdb, sql server and remote

Microsoft.AspNet.Identity helps the application to work with User Identity and persist it to a data store such as sql server, ravendb, mongo and so on

Microsoft.AspNet.Identity.Entity Framework persists the identity in sql server

Login page invokes the account controllers login action method

Login method consists of 2 methods a get allowing anonymous users and a post. Identity manager validates user credentials

Identity Manager is declared as a public property and instantiated in the constructor

In Models folder AccountViewModels contains viewmodels needed by account controller, essentially data transfer objects

IdentityModels class contains 2 classes, applicationuser, information to be stored about the user. applicationdbcontext is the context used to persist data into sql server, derives from identitydbcontext

Add property to application user to gather and display custom information about the user

Create class and add dbset to applicationdbcontext to add a table to the database

Package manager console, enable migrations for this project, entity framework feature that looks at model and database, figures out if there are any changes and generates change scripts that can be run against the database to fix up the schema

In newly generated configure class, in the constructor set automaticmigrationsenabled to true


View database in sql server, the new field and table automatically added

App_Start folder, Startup.Auth file uncomment GoogleAuthentication

Launch application, click on login and then google

Redirect to, click accept

Redirected to application authenticated

Click register and logged into the application

Account Controller ExternalLoginCallBack method gets hit after authentication process from external provider

Default Success Warning Important Info Inverse
B S W I ? O