Execute pre-checks before running your application!
public class MyAppPolicyConfiguration : AbstractPolicyConfiguration
{
public MyAppPolicyConfiguration(IServiceLocator serviceLocator)
: base(serviceLocator)
{
Check<ICurrencyProvider>(provider =>
{
//do sth
return false;
});
Check<IStorageClient>(client =>
{
return client.CheckAccessControl();
});
}
}
IFluentBootstrap _policies;
ContainerBuilder builder = new ContainerBuilder();
builder.RegisterType<StorageClient>().As<IStorageClient>().SingleInstance();
builder.RegisterType<CurrencyProvider>().As<ICurrencyProvider>().SingleInstance();
builder
.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
.AssignableTo<AbstractPolicyConfiguration>()
.As<AbstractPolicyConfiguration>();
var container = builder.Build();
_policies = FluentBootstrap.Instance;
_policies.Configure(ctx =>
{
ctx.Use(new AutofacServiceLocator(container));
});
_policies.Execute();
@ziλasal