-
-
Notifications
You must be signed in to change notification settings - Fork 10
Custom Simplify.Web bootstrapper
Alexanderius edited this page Jul 3, 2025
·
3 revisions
Each Simplify.Web framework class is replaceable. You can create your implementation of any class and use it instead. To do that, create a class in your web-site assembly derived from BaseBootstrapper
and then use the provided methods to register your implementation.
Some Simplify.Web classes are registered by default using the general register method of the IOC container without custom creation. For those classes, you can simply set a type.
public class MyPageGenerator(IPageGenerator baseGenerator) : IPageGenerator
{
public string Generate(IDataCollector dataCollector)
{
var result = baseGenerator.Generate(dataCollector);
// Your custom code
return result;
}
}
public class MyBootstrapper : BaseBootstrapper
{
public override void RegisterPageGenerator()
{
BootstrapperFactory.ContainerProvider.Register<PageGenerator>();
BootstrapperFactory.ContainerProvider.Register<IPageGenerator>(r => new MyPageGenerator(r.Resolve<PageGenerator>()));
}
}
- The
MyBootstrapper
class will be loaded by the framework automatically when the framework starts.
You can override an internal type by using the RegisterSimplifyWeb
override parameter:
.RegisterSimplifyWeb(registrationsOverride: x =>
{
x.OverridePageGenerator(r =>
{
r.Register<PageGenerator>();
r.Register<IPageGenerator>(r => new MyPageGenerator(r.Resolve<PageGenerator>()));
});
})
- Getting Started
- Main Simplify.Web principles
- Simplify.Web controllers
- Simplify.Web views
- Simplify.Web templates
- Simplify.Web configuration
- Templates variables
- Static content
- Template factory
- Data collector
- String table
- File reader
- Web context
- Environment
- Dynamic environment
- Language manager
- Redirector
- HTML