This repository was archived by the owner on Nov 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Assembly Scanning Default Convention
Acoustic edited this page Sep 14, 2010
·
1 revision
Snap can be configured to scan assemblies with the default convention. The default convention attempts to pair interceptors and attributes to make configuration simple and brief.
The default scanning convention is easy to set up.
SnapConfiguration.For<StructureMapAspectContainer>(c =>
{
c.IncludeNamespaceRoot("My.Test");
c.Scan(s => s.ThisAssembly().WithDefaults());
});
This configuration scans the current assembly (the one that’s running this code) with the default conventions. Each interceptor found with a matching attribute will be automatically bound.
e.g. MySampleInterceptor and MySampleAttribute would be paired together
Obviously the current assembly is not always the one needing to be scanned. In such cases, the following configuration syntax registers an external assembly for scanning with the default convention.
SnapConfiguration.For<StructureMapAspectContainer>(c =>
{
c.IncludeNamespaceRoot("My.Test");
c.Scan(s => s.Assembly(someOtherAssembly).WithDefaults());
});
Happy coding!