Show / Hide Table of Contents

    IDwMeta.ModelType Property

    .NET Standard 2.x

    Gets the type of the model embedded in the DataStore.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

    Type ModelType { get; }
    

    Return

    System.Type

    The type of the model embedded in the DataStore.

    Examples

    The following code example demonstrates how to use the ModelType property.

    using DWNet.Data;
    using System;
    using System.Reflection;
    
    namespace Appeon.ApiDoc.IDwMetaExamples
    {
        public class ModelTypeExample
        {
            private readonly SchoolContext _context;
    
            public ModelTypeExample(SchoolContext dataContext)
            {
                // Sets the data context
                _context = dataContext;
            }
    
            public void Example()
            {
                // Instantiates datastore with datawindow: d_department_course
                var datastore = new DataStore("d_department_course", _context);
    
                datastore.Retrieve();
    
                // Gets the type of the model embedded in the DataStore.
                var type = datastore.DwMeta.ModelType;
                Console.WriteLine("Name: {0}", type.Name);
                Console.WriteLine("Namespace: {0}", type.Namespace);
                Console.WriteLine("FullName: {0}", type.FullName);
    
                foreach (var item in type.CustomAttributes)
                {
                    Console.WriteLine("AttributeType: {0}", item.AttributeType.Name);
                }
    
                /*This code produces the following output:
                
                Name: D_Department_Course
                Namespace: Appeon.ApiDoc.Models
                FullName: Appeon.ApiDoc.Models.D_Department_Course
                AttributeType: DataWindowAttribute
                AttributeType: TableAttribute
                AttributeType: FromTableAttribute
                AttributeType: FromTableAttribute
                AttributeType: DwSelectAttribute
                AttributeType: DwSortAttribute
                AttributeType: DwGroupByAttribute
                AttributeType: DwGroupByAttribute
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department_Course
    DataWindow File: d_department_course

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon