@@ -5,6 +5,16 @@ stores are supported:
55
66* Azure Storage Account: This store has the branding manifest stored on an Azure Storage account
77
8+ ## Installation
9+ There are several NuGet packages installable
10+
11+ ```
12+ NuGet\Install-Package CoreHelpers.Branding.Runtime.Abstractions
13+ NuGet\Install-Package CoreHelpers.Branding.Runtime
14+ NuGet\Install-Package CoreHelpers.Branding.AspNet
15+ NuGet\Install-Package CoreHelpers.Branding.Stores.AzureStorage
16+ ```
17+
818## Configuration
919The system must be configured by adding the following section into the application configuration:
1020
@@ -28,11 +38,43 @@ the structure is as follows:
2838}
2939```
3040
31- ## Registering services
41+ ## Register services
3242The system is compatible with the .NET Core Dependency Injection. The following requests allow to regsiter
3343the different services. This code should be added in the service configuration section of your application:
3444
3545```
3646builder.Services.AddBrandingServices();
3747builder.Services.AddBrandingServices4AzureStorage(builder.Configuration);
38- ```
48+ ```
49+
50+ ## Apply branding based on request host
51+ A common scenario is to apply the branding based on the host header of the incoming requets. The following middleware
52+ allows injects the current branding based on the host header:
53+
54+ ```
55+ app.UseBrandingWithRequestHost("YOUR_APPLICATION_ID", async (brandingManager) =>
56+ {
57+ var defaultBranding = brandingManager.BuildMutableBranding("YOUR_APP_TITLE");
58+
59+ //
60+ // Add more defaults here ....
61+ //
62+ await Task.CompletedTask;
63+
64+ return defaultBranding;
65+ });
66+ ```
67+
68+ ## Use current branding in views
69+ The current branding in views can be used easily by injecting the brand state and using them like
70+ a view model. Add the following lines to _ ViewImports.cshtml:
71+
72+ ```
73+ @inject CoreHelpers.Branding.Runtime.IBrandingStateService branding
74+ ```
75+
76+ In every view the branding model can be used as follows:
77+
78+ ```
79+ <a class="link" target="_new" href="@branding.CurrentCompanyBranding.Legals[nLegalItems.imprint]">Imprint</a>
80+ ```
0 commit comments