WebExtensions.UseDataWindow(this IApplicationBuilder app, Action<IDataWindowOptions> options) Method
.NET Standard 2.x
Parses and loads all models (converted from DataWindow objects) from the assembly list specified by options
.
Namespace: DWNet.Data.AspNetCore
Assembly: DWNet.Data.AspNetCore.dll
Syntax
public static IApplicationBuilder UseDataWindow(this IApplicationBuilder app, Action<IDataWindowOptions> options)
Parameters
app
Microsoft.AspNetCore.Builder.IApplicationBuilder
The IApplicationBuilder
object which provides the mechanism to configure an application's request pipeline.
options
System.Action<DWNet.Data.IDataWindowOptions>
An Action<IDataWindowOptions>
object which can be used to specify the assembly list and the logging object used when loading models.
If the assembly list is not specified, it will use the assemblies which are already loaded into the current application domain by default.
Returns
Microsoft.AspNetCore.Builder.IApplicationBuilder
Returns the IApplicationBuilder
object.
Remarks
It is the same as calling the DwModelManager.LoadDwModels method.
It loads all models (converted from the DataWindow object .pbw
file(s)) from the assemblies which are already loaded into the current application domain.
Examples
The following code example demonstrates how to use the UseDataWindow
method in the Configure
method of the Startup
class to load models.
using DWNet.Data.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Reflection;
namespace Appeon.ApiDoc.WebExtensionsExamples
{
public class Startup_UseDataWindowExample
{
// Uses this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Usage 1:
// Parses and loads models from assemblies loaded in current application domain.
app.UseDataWindow();
// Usage 2:
// Specifies the assembly list to load models.
var assmblyList = new List<Assembly>() { this.GetType().Assembly };
// Defines a logging object and displays logs on console
var loggerFactory = new LoggerFactory();
loggerFactory.AddConsole(LogLevel.Debug, true);
app.UseDataWindow(o =>
{
o.Assemblies = assmblyList;
o.LoggerFactory = loggerFactory;
});
}
}
}
Applies to
.NET Standard
2.x