Created
February 15, 2020 13:24
-
-
Save arialdomartini/fa06f8f71af9c578e7f93b45382cae87 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
internal class MyModule : Module | |
{ | |
readonly SourceSettings[] _settings = | |
{ | |
new SourceSettings {FTPServerAddress = "ftp1.server1.lab", Filter = "ALL"}, | |
new SourceSettings {FTPServerAddress = "ftp2.server2.lab", Filter = "pdf;docx"}, | |
new SourceSettings {FTPServerAddress = "ftp3.server3.lab", Filter = "pdf"} | |
}; | |
protected override void Load(ContainerBuilder builder) | |
{ | |
foreach (var sourceSettings in _settings) | |
{ | |
builder | |
.Register(c => new FTPDocumentSource(sourceSettings.FTPServerAddress)) | |
.Named<IDocumentSource>(sourceSettings.Filter != "ALL" ? "do-not-decorate" : "decorate"); | |
builder.RegisterDecorator<IDocumentSource>((c, inner) => new DocumentSourceFilteringDecorator(inner), fromKey: "decorate"); | |
} | |
builder.RegisterType<AggregatedDocumentSource>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment