Asp.Net.Core完全自定义

问题描述 投票:-1回答:1

我正在尝试在Asp.net.core中自定义身份表。是否可以删除表或列,使用我自己的表?我在Google或其他开发人员中找不到任何答案。

asp.net asp.net-core .net-core asp.net-core-identity
1个回答
0
投票

ciao,sempui postèscritto in maniera semplice e precisa:

How to add Custom User Properties in Identity Membership System

这是一个小例子:

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;

namespace Identity.Models
{
    public class AppUser : IdentityUser
    {
        public Country Country { get; set; }

        public int Age { get; set; }

        [Required]
        public string Salary { get; set; }
    }

    public enum Country
    {
        USA, UK, France, Germany, Russia
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.