| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using Microsoft.AspNetCore.Identity;
- using System.ComponentModel.DataAnnotations.Schema;
- namespace Infrastructure.Persistence.Identity
- {
- public sealed class ApplicationUser : IdentityUser
- {
- [NotMapped]
- public string ID
- {
- get => Id;
- private set => Id = value;
- }
- public string? FullName { get; private set; }
- public bool IsDeleted { get; private set; } = false;
- // EF Core / Identity requires a public parameterless ctor
- public ApplicationUser() { }
- private ApplicationUser(string id)
- {
- if (string.IsNullOrWhiteSpace(id))
- {
- throw new ArgumentException("ID is required.", nameof(id));
- }
- ID = id;
- }
- public static ApplicationUser Create(string id, string? fullName = null)
- {
- var user = new ApplicationUser(id);
- user.FullName = fullName;
- return user;
- }
- public void SetDeleted(bool isDeleted)
- {
- IsDeleted = isDeleted;
- }
- }
- }
|