Show / Hide Table of Contents

    DataStore.DataStore(Type modelType, DataContext context) Constructor

    .NET Standard 2.x

    Initializes a new instance of the DataStore class using a Type object and a DataContext object.

    Namespace: DWNet.Data

    Assembly: DWNet.Data.dll

    Syntax

      public DataStore(Type modelType, DataContext context);
    

    Parameters

    modelType System.Type

    The type of a DataWindow object.

    context SnapObjects.Data.DataContext

    A DataContext object which represents the entry to the database.

    Examples

    The following code example creates a DataStore object and specifies the type of DataObject, and data DataContext.

    using SnapObjects.Data;
    using DWNet.Data;
    using System;
    using System.Collections.Generic;
    using Appeon.ApiDoc.Models;
    
    namespace Appeon.ApiDoc.DataStoreExamples
    {
        public class DataStoreExample
        {
            private readonly SchoolContext _context;
    
            public DataStoreExample(SchoolContext dataContext)
            {
                // Set Data Context
                _context = dataContext;
            }
    
            public void Example6()
            {
                // Instantiates the datastore with d_department DataWindow
                var department = new DataStore(typeof(D_Department), _context);
    
                int row = department.Retrieve();
                Console.WriteLine("Retrieve Count = {0}", row);
    
                /*This code produces the following output:
                
                Retrieve Count = 4    
                */
            }
        }
    }
    

    Example Refer To

    Model Class: D_Department
    DataWindow File: d_department

    Applies to

    .NET Standard

    2.x

    Back to top Generated by Appeon