Last active
July 22, 2016 05:59
-
-
Save hidegh/7a2ae10ce74d8222bb234b405c1aa0a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BankingDetails | |
{ | |
protected string EncryptedAccountNumber { get; set; } | |
protected string EncryptedRoutingTransitNumber { get; set; } | |
public string GetAccountNumber (IDecryptor decryptor) | |
{ | |
return string.IsNullOrWhitespace(EncryptedAccountNumber) ? "" : decryptor.Decrypt(EncryptedAccountNumber); | |
} | |
public void SetAccountNumber (IEncryptor encryptor, string accountNumber) | |
{ | |
// TODO: add input checking (format, etc.) | |
EncryptedAccountNumber = string.IsNullOrWhitespace(accountNumber) ? "" : encryptor.Encrypt(accountNumber); | |
} | |
// NOTE: | |
// ... so on for routing transit number | |
// | |
// BankingDetails class is an ORM mapped entity, | |
// ...and since I did not wanted to include service locator and had no better idea to inject IDecryptor and IEncryptor, | |
// ...had to use Get/Set methods (with additional IDecryptor/IEncryptor parameters) instead of plain getters/setters... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment