Show / Hide Table of Contents

    DwDataAttribute Class

    .NET Standard 2.x

    Specifies the provider for the initialized data, corresponding to the initialized data defined by DataWindow.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Inheritance Constructor

    System.Attribute

    Syntax

       [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
        public class DwDataAttribute : Attribute
    

    Constructors

    Name Description
    DwDataAttribute(Type dataProviderType) Initializes a new instance of the DwDataAttribute class.

    Properties

    Name Return Type Description
    DataProviderType type The type of the initial data provider

    Remarks

    The provider is inherited from the DwDataInitializer class. It contains the data for initializing DataStore. When exporting model from DataWindow, if DataWindow has initialized data, the class of the initial data provider will be automatically created.

    Examples

    The following code example demonstrates how to use the Model DwData attribute. The data in DataStore is not from the database, but from the external data source. It is defined in the class specified by the DwData attribute.

    Example Method:
    using System;
    using DWNet.Data;
    
    namespace Appeon.ApiDoc.DwDataAttributeExamples
    {
        public class DwDataAttributeExample
        {
            public DwDataAttributeExample()
            {
            }
    
            public void Example()
            {
    
                var datastore = new DataStore("d_external_data");
    
                // Shows the total number of initial data rows
                Console.WriteLine($"datastore RowCount={datastore.RowCount}.");
    
                /* This code example produces the following output:
                
                datastore RowCount=3.
                */
            }
        }
    }
    

    Example Refer To

    DataWindow File: d_external

    Back to top Generated by Appeon