| 1234567891011121314151617181920212223242526272829303132333435 |
- using System.Data.Entity;
- using System.Security.Claims;
- using System.Threading.Tasks;
- using Microsoft.AspNet.Identity;
- using Microsoft.AspNet.Identity.EntityFramework;
- namespace Winsoft.GOV.XF.WX.Models
- {
- // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit https://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
- public class ApplicationUser : IdentityUser
- {
- public string Hometown { get; set; }
- public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
- {
- // 请注意,authenticationType 必须与 CookieAuthenticationOptions.AuthenticationType 中定义的相应项匹配
- var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
- // 在此处添加自定义用户声明
- return userIdentity;
- }
- }
- public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
- {
- public ApplicationDbContext()
- : base("DefaultConnection", throwIfV1Schema: false)
- {
- }
- public static ApplicationDbContext Create()
- {
- return new ApplicationDbContext();
- }
- }
- }
|