Show / Hide Table of Contents

    WebExtensions.UseDataWindow(this IApplicationBuilder app) Method

    .NET Standard 2.x

    Parses and loads all models (converted from DataWindow objects) from the assemblies which are already loaded into the current application domain.

    Namespace: DWNet.Data.AspNetCore

    Assembly: DWNet.Data.AspNetCore.dll

    Syntax

     public static IApplicationBuilder UseDataWindow(this IApplicationBuilder app);
    

    Parameters

    app Microsoft.AspNetCore.Builder.IApplicationBuilder

    The IApplicationBuilder object which provides the mechanism to configure an application's request pipeline.

    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

    Back to top Generated by Appeon