Class CsvBlockedAddressDataSource
- Namespace
- SEBT.Portal.Infrastructure.Services
- Assembly
- SEBT.Portal.Infrastructure.dll
Loads blocked-address entries from a CSV embedded as an assembly resource. Expected CSV columns (Salesforce export shape): OFF_ADR_L1__c, OFF_ADR_L2__c, OFF_ADR_CTY__c, OFF_ADR_PO_BOX__c, OFF_ADR_STA__c, OFF_ADR_ZIP__c.
Rows with a Line 1 value yield an entry with that street; rows with only a PO box number synthesize a "PO BOX {n}" street. ZIP+4 input is reduced to the 5-digit prefix; rows with fewer than 5 digits in the ZIP column are dropped.
The parser is a pragmatic comma-split rather than a full RFC 4180 implementation: the upstream Salesforce export does not quote fields or include embedded commas. If that ever changes, switch to a CSV library before extending this class.
public sealed class CsvBlockedAddressDataSource : IBlockedAddressDataSource
- Inheritance
-
objectCsvBlockedAddressDataSource
- Implements
Methods
EmbeddedFileExists(string)
Whether a CSV with this file name is embedded from the BlockedAddresses folder.
public static bool EmbeddedFileExists(string fileName)
Parameters
fileNamestring
Returns
- bool
FromCsv(string)
Test-friendly constructor that parses CSV content from an in-memory string rather than an assembly resource.
public static CsvBlockedAddressDataSource FromCsv(string csvContent)
Parameters
csvContentstring
Returns
FromEmbeddedFile(string)
Loads a CSV embedded from the BlockedAddresses folder.
Throws when no such file is embedded, so a misconfigured name cannot silently disable blocking.
public static CsvBlockedAddressDataSource FromEmbeddedFile(string fileName)
Parameters
fileNamestring
Returns
GetEntries()
public IReadOnlyCollection<BlockedAddressEntry> GetEntries()
Returns
- IReadOnlyCollection<BlockedAddressEntry>