2015/09/11

IdentityModels 사용자 컬럼 추가

# IdentityModesl.cs

    public class ApplicationUser : IdentityUser
    {
          public string Comment { get; set; }   
    }

    및 IdentityUser 상속 받는 사용자 정의 DBModel (Table)

 

# Configuration.cs  기본값

 

 

PM> Enable-Migrations

PM> Add-Migration -ConfigurationTypeName  MyApp.Models.Configuration   MyDBModel
        --> 실행하면, Migrations 폴더에  일자_MyDBModel.cs  Migration 코드 파일이 생성됨
               생성된 파일에서, 컬럼 정의를 수정후

PM> Update-Database -ConfigurationTypeName  MyApp.Models.Configuration 
       --> Add-Migration 여러개가 생성된 경우, Update-Database –TargetMigration:"xxx" 지정

 

발생할수 있는 오류 :  "More than one migrations configuration type was found in the assembly 'MyApp'. Specify the name of the one to use."

특정   ConfigurationTypeName  지정하는 이유는  Migrations 외 다른 위치에 Configuration 가 있는 경우에  어떤걸 사용할지 별도로 위치를 지정해줘야 하는 것 같음.

 

 


가장 많이 본 글