Using LinFu - TylerBrinks/Snap GitHub Wiki
| Dependency | Version |
| Snap | Current |
| Snap.Autofac.dll | Current |
| LinFu.Core.dll | v2.0.x |
LinFu uses the concept of a service container to create object instances. Because the container builder is an instantiated object, it’s necessary to use Snap’s instance-based fluent configuration.
// Create a LinFu ServiceContainer
var container = new ServiceContainer();
container.LoadFrom(AppDomain.CurrentDomain.BaseDirectory, "*.dll");
// Configure Snap with the container instance
SnapConfiguration.For(new LinFuAspectContainer(container)).Configure(c =>
{
c.IncludeNamespaceRoot("My.Namespace.Root");
//c.IncludeNamespace("My.Namespace*");
c.Bind<HandleErrorInterceptor>().To<HandleErrorAttribute>();
});
LinFu is now fully configured to build proxied instances that will run your configured interceptors.
var instance = container.GetService<IMyType>();
Happy coding!