public IdentityRole(Entity entity) { if (entity == null) { throw new ArgumentNullException("entity"); } Entity = entity; KeyProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.RoleKey); NameProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.RoleName) ?? ProjectUtilities.FindNameProperty(entity); UsersProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.RoleUsers); ClaimsProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.RoleClaims); LoadByKeyMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadRoleByKey); if (LoadByKeyMethod != null) { LoadByKeyMethodName = LoadByKeyMethod.Name; } else if (KeyProperty != null && Entity.LoadByKeyMethod != null) { LoadByKeyMethodName = Entity.LoadByKeyMethod.Name; } else { LoadByKeyMethodName = "LoadByEntityKey"; } LoadByNameMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadRoleByName) ?? Entity.LoadByCollectionKeyMethod; LoadAllMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadAllRoles) ?? Entity.LoadAllMethod; }
public IdentityUser(Entity entity) { if (entity == null) { throw new ArgumentNullException("entity"); } Entity = entity; KeyProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserKey); UserNameProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserName) ?? ProjectUtilities.FindNameProperty(entity); NormalizedUserNameProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserNormalizedName) ?? UserNameProperty; CreationDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserCreationDate); EmailProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserEmail); EmailConfirmedProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserEmailConfirmed); PhoneNumberProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserPhoneNumber); PhoneNumberConfirmedProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserPhoneNumberConfirmed); PasswordProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserPassword); LastPasswordChangeDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserLastPasswordChangeDate); FailedPasswordAttemptCountProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserFailedPasswordAttemptCount); FailedPasswordAttemptWindowStartProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserFailedPasswordAttemptWindowStart); LockoutEnabledProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserLockoutEnabled); LockoutEndDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserLockoutEndDate); LastProfileUpdateDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserLastProfileUpdateDate); TwoFactorEnabledProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserTwoFactorEnabled); SecurityStampProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserSecurityStamp); RolesProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserRoles); ClaimsProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserClaims); LoginsProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserLogins); LoadByKeyMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByKey); if (LoadByKeyMethod != null) { LoadByKeyMethodName = LoadByKeyMethod.Name; } else if (KeyProperty != null && Entity.LoadByKeyMethod != null) { LoadByKeyMethod = Entity.LoadByKeyMethod; LoadByKeyMethodName = Entity.LoadByKeyMethod.Name; } else { LoadByKeyMethodName = "LoadByEntityKey"; } LoadByUserNameMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByUserName) ?? Entity.LoadByCollectionKeyMethod; LoadByEmailMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByEmail) ?? Entity.Methods.Find("LoadByEmail", StringComparison.OrdinalIgnoreCase) ?? (EmailProperty != null && EmailProperty.IsCollectionKey ? Entity.LoadByCollectionKeyMethod : null); LoadByUserLoginInfoMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByUserLoginInfo); LoadAllMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadAllUsers) ?? Entity.LoadAllMethod; }
public IdentityUser(Entity entity) { if (entity == null) { throw new ArgumentNullException("entity"); } Entity = entity; KeyProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserKey); UserNameProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.UserName) ?? ProjectUtilities.FindNameProperty(entity); CreationDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.CreationDate); EmailProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.Email); EmailConfirmedProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.EmailConfirmed); PhoneNumberProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.PhoneNumber); PhoneNumberConfirmedProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.PhoneNumberConfirmed); PasswordProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.Password); LastPasswordChangeDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.LastPasswordChangeDate); FailedPasswordAttemptCountProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.FailedPasswordAttemptCount); FailedPasswordAttemptWindowStartProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.FailedPasswordAttemptWindowStart); LockoutEnabledProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.LockoutEnabled); LockoutEndDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.LockoutEndDate); LastProfileUpdateDateProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.LastProfileUpdateDate); TwoFactorEnabledProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.TwoFactorEnabled); SecurityStampProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.SecurityStamp); RolesProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.Roles); ClaimsProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.Claims); LoginsProperty = ProjectUtilities.FindByPropertyType(Entity, PropertyType.Logins); LoadByKeyMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByKey); if (LoadByKeyMethod != null) { LoadByKeyMethodName = LoadByKeyMethod.Name; } else if (KeyProperty != null && Entity.LoadByKeyMethod != null) { LoadByKeyMethodName = Entity.LoadByKeyMethod.Name; } else { LoadByKeyMethodName = "LoadByEntityKey"; } LoadByUserNameMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByUserName) ?? Entity.LoadByCollectionKeyMethod; LoadByEmailMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByEmail); LoadByProviderKeyMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadUserByProviderKey); LoadAllMethod = ProjectUtilities.FindByMethodType(Entity, MethodType.LoadAll) ?? Entity.LoadAllMethod; }