DwModelManager.LoadDwModels(Action<IDataWindowOptions> options = null) Method
.NET Standard 2.x
Loads the DataWindow models. You can specify the assembly to load and the logging object to use.
Namespace: DWNet.Data
Assembly: DWNet.Data.dll
Syntax
public static void LoadDwModels(Action<IDataWindowOptions> options = null);
Parameters
options
System.Action<IDataWindowOptions>
An IDataWindowOptions
object which can specify the assembly and the logging object to load DataWindow.
Examples
The following code example demonstrates how to use LoadDwModels to load all of the DataWindows in the assembly for the current class, and specify to display logs (if any) on the console.
using DWNet.Data;
using System;
using Microsoft.Extensions.Logging;
namespace Appeon.ApiDoc.DwModelManagerExamples
{
public class LoadDwModelsExample
{
public LoadDwModelsExample()
{
}
public void Example()
{
// Gets the assembly for the current class
var assmbly = this.GetType().Assembly;
// Defines a logging object and displays logs on console
LoggerFactory loggerFactory = new LoggerFactory();
loggerFactory.AddConsole(LogLevel.Debug, true);
DwModelManager.LoadDwModels(a => { a.Assemblies.Add(assmbly);
a.LoggerFactory = loggerFactory;
});
// Checks if DataWindow contains d_department
var result = DwModelManager.DataWindows.ContainsKey("d_department");
Console.WriteLine($"result={result}");
/*This code produces the following output:
result=True
*/
}
}
}
Example Refer To
Model Class: D_Department
DataWindow File: d_department