public AccountResourceEntity(AccountEntity account, AccountResourceType pointerType) { switch (pointerType) { case AccountResourceType.None: break; case AccountResourceType.AccountName: this.Id = GenerateResourceId(AccountResourceType.AccountName, account.AccountName); break; case AccountResourceType.Phone: this.Id = GenerateResourceId(AccountResourceType.Phone, account.PhoneNum); break; case AccountResourceType.Email: this.Id = GenerateResourceId(AccountResourceType.Email, account.Email); break; default: break; } this.PointerType = pointerType; this.AccountId = account.Id; }
public static string GenerateResourceId(AccountResourceType resourceType, string postfixId) { return($"{resourceType}-{postfixId}"); }