...
The line shown above should be added at the end of the constructor for the Startup class to load the configuration for log4net, the logging system used by Lynicon.
ConfigureServices
Code Block | ||
---|---|---|
| ||
public void ConfigureServices(IServiceCollection services) { ... services.AddIdentity<User, IdentityRole>() .AddDefaultTokenProviders(); services.AddMvc(options => options.AddLyniconOptions()) .AddApplicationPart(typeof(LyniconSystem).Assembly); services.AddAuthorization(options => options.AddLyniconAuthorization()); services.AddLynicon(options => options.UseConfiguration(Configuration.GetSection("Lynicon:Core")) .UseModule<CoreModule>() ) .AddLyniconIdentity(); } |
...
- Ensure services.AddIdentity<,>() is called here. Don't use the configuration method AddEntityFrameworkStores<ApplicationDbContext>() as the appropriate entity framework stores for the user system are set up in the call to AddLyniconIdentity() later. This sets up Identity Framework for user management as used by Lynicon.
- Ensure AddMvc() is called here with the options lambda, calling at least AddLyniconOptions() to set up MVC for Lynicon. Call This call sets up custom binding providers and a custom metadata provider for Lynicon. Call AddApplicationPart for all Lynicon assemblies in the project, at least the core Lynicon assembly.
- Ensure AddAuthorization() is called here with the options lambda, allowing you to call AddLyniconAuthorization to set up the default options for Lynicon authorization. See Custom Permissions for how to customise Lynicon's use of the Policy-based authorization in ASP.Net Core.
- Finally ensure .AddLynicon() is called to set up services for Lynicon itself. The final AddLyniconIdentity() is used to set up a custom ASP.Net Identity-based membership system for Lynicon.
The Lynicon options configuration methods include the following:
Configuration Method | Purpose |
---|---|
UseConfiguration(IConfigurationSection section) | Load the specified configuration section into Lynicon's core options |
UseModule<TModule>(params object[] moduleParams) | Load the specified module of type TModule into Lynicon, using a list of configuration parameters dependent on the module |
UseTypeSetup(Action<ITypeSystemRegistrar> setupTypes) | Use the given action to set up any number of custom type configurations. See Data System Configuration |
To see the possible methods for setting up membership systems see Setting Up User Management
Configure
Code Block | ||
---|---|---|
| ||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime life)
{
...
app.UseIdentity();
...
app.ConstructLynicon();
app.UseMvc(routes =>
{
routes.MapLyniconRoutes();
routes.MapDataRoute<TestContent>("test", "test/{_0}", new { controller = "Test", action = "Index" });
routes.MapDataRoute<HeaderContent>("header", "test/{_0}", new { controller = "Test", action = "Header" });
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
app.InitialiseLynicon(life);
} |
Ensure the parameters for this setup method include