using System.Data.Entity; using System.Security.Claims; using System.Threading.Tasks; using Microsoft.AspNet.Identity; using Microsoft.AspNet.Identity.EntityFramework; namespace Chruch.Net.Models { // 您可將更多屬性新增至 ApplicationUser 類別,藉此為使用者新增設定檔資料,如需深入了解,請瀏覽 https://go.microsoft.com/fwlink/?LinkID=317594。 public class ApplicationUser : IdentityUser { public async Task GenerateUserIdentityAsync(UserManager manager) { // 注意 authenticationType 必須符合 CookieAuthenticationOptions.AuthenticationType 中定義的項目 var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); // 在這裡新增自訂使用者宣告 return userIdentity; } } public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext() : base("DefaultConnection", throwIfV1Schema: false) { } public static ApplicationDbContext Create() { return new ApplicationDbContext(); } } }