RemoteTable<T>

Overview

The RemoteTable<T> class represents the data table on the remote DataAbstract server. The T-type defines which Schema tables to represent. Since it implements the System.Linq.IQueryProvider interface, it can be used as LINQ Provider for DA data sources.

Service class for LINQ

To create a LINQ request for a DA server, you should have a set of classes that represent tables in the schema. These classes are used as generic types in RemoteTable<T> instances.

In the source code below, you can see an example of a T-class:

[RemObjects.DataAbstract.Linq.TableName("Groups")]
    public partial class Groups : System.ICloneable, System.ComponentModel.INotifyPropertyChanged, System.ComponentModel.INotifyPropertyChanging {
        private int f____GroupId;
        private string f____GroupName;
        [RemObjects.DataAbstract.Linq.FieldName("GroupId")]
        [RemObjects.DataAbstract.Linq.DataType(RemObjects.DataAbstract.Schema.DataType.Integer)]
        [RemObjects.DataAbstract.Linq.PrimaryKey()]
        [RemObjects.DataAbstract.Linq.LogChanges()]
        public virtual int GroupId {
            get {
                return f____GroupId;
            }
            set {
                if ((System.Collections.Generic.Comparer<int>.Default.Compare(this.f____GroupId, value) != 0)) {
                    this.m____TriggerPropertyChanging("GroupId");
                    f____GroupId = value;
                    this.m____TriggerPropertyChanged("GroupId");
                }
            }
        }
        [RemObjects.DataAbstract.Linq.FieldName("GroupName")]
        [RemObjects.DataAbstract.Linq.DataType(RemObjects.DataAbstract.Schema.DataType.WideString)]
        [RemObjects.DataAbstract.Linq.LogChanges()]
        public virtual string GroupName {
            get {
                return f____GroupName;
            }
            set {
                if ((System.Collections.Generic.Comparer<string>.Default.Compare(this.f____GroupName, value) != 0)) {
                    this.m____TriggerPropertyChanging("GroupName");
                    f____GroupName = value;
                    this.m____TriggerPropertyChanged("GroupName");
                }
            }
        }
        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
        public event System.ComponentModel.PropertyChangingEventHandler PropertyChanging;
        object System.ICloneable.Clone() {
            Groups v____new = new Groups();
            v____new.f____GroupId = this.f____GroupId;
            v____new.f____GroupName = this.f____GroupName;
            return v____new;
        }
        private void m____TriggerPropertyChanged(string p____PropertyName) {
            if ((this.PropertyChanged != null)) {
                this.PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(p____PropertyName));
            }
        }
        private void m____TriggerPropertyChanging(string p____PropertyName) {
            if ((this.PropertyChanging != null)) {
                this.PropertyChanging(this, new System.ComponentModel.PropertyChangingEventArgs(p____PropertyName));
            }
        }
    }

Normally, you will not need to create classes for your Schema manually. Instead, you can use the "Create DA Linq Classes" option of the LinqDataAdapter control to generate it. For more information about this option, see the DA LINQ article.

Location


 

constructor    (declared in RemoteTableQuery<T>)

Default constructor that creates an instance of the RemoteTableQuery.

 

constructor

 

RemoteTable<T>()

 

Sub New()

constructor (IRemoteQueryProvider, Expression)    (declared in RemoteTableQuery<T>)

Creates a new instance of the RemoteTableQuery and associates it with a LINQ Expression and provider.

 

constructor(aProvider: IRemoteQueryProvider; aExpression: Expression)

 

RemoteTable<T>(IRemoteQueryProvider aProvider, Expression aExpression)

 

Sub New(aProvider As IRemoteQueryProvider, aExpression As Expression)

Parameters:

  • aProvider: Implementor of IRemoteQueryProvider that is able to execute aExpression.
  • aExpression: LINQ Expression appropriate to current instance.

constructor (LinqDataAdapter)

Creates a new instance of the RemoteTable class and processes the following:

  • Stores the reference for the parent dataAdapter
  • Sets the TableName property
  • Fills the Schema property according to the attributes of the type T.

 

constructor(dataAdapter: LinqDataAdapter)

 

RemoteTable<T>(LinqDataAdapter dataAdapter)

 

Sub New(dataAdapter As LinqDataAdapter)

Parameters:

  • dataAdapter: Data Adapter instance that will provide data and process changes of this RemoteTable instance

CancelChanges

 

method CancelChanges

 

void CancelChanges()

 

Sub CancelChanges()

Changes

Gets a collection of DeltaChange items.

This collection maintains a list of inserted, deleted and updated rows in the DataTable. It is used internally by Data Adapter to send the modified data back to the server.

 

property Changes: Delta read;

 

Delta Changes { get; }

 

ReadOnly Property Changes() As Delta

CloneTable

 

method CloneTable(data: T): T

 

T CloneTable(T data)

 

Function CloneTable(data As T) As T

Parameters:

  • data:

CreateQuery

 

method CreateQuery(expression: Expression): IQueryable

 

IQueryable CreateQuery(Expression expression)

 

Function CreateQuery(expression As Expression) As IQueryable

Parameters:

  • expression:

CreateQuery<S>

 

method CreateQuery<S>(expression: Expression): IQueryable<S>

 

IQueryable<S> CreateQuery<S>(Expression expression)

 

Function CreateQuery<S>(expression As Expression) As IQueryable<S>

Parameters:

  • expression:

DataAdapter

 

property DataAdapter: LinqDataAdapter read;

 

LinqDataAdapter DataAdapter { get; }

 

ReadOnly Property DataAdapter() As LinqDataAdapter

DeleteRow

Deletes the row that represents the provided object from the corresponding RemoteTable instance. This change will be applied to the remote database once the parent LinqDataAdapter.ApplyChanges method is called. This method returns the DeltaChange class, which represents the data table changes explained above. This object can be used if you need to set some of its properties manually.

 

method DeleteRow(data: T): DeltaChange

 

DeltaChange DeleteRow(T data)

 

Function DeleteRow(data As T) As DeltaChange

Parameters:

  • data: Object whose representation should be deleted from the database.

DeriveSchema  protected

Instantiates a 'Schema' property with new SchemaDataTable. This schema will be based on the T-type of current RemoteTable instance. Schema data is filled from field Attributes of T-class (such as FieldNameAttribute, DataTypeAttribute, etc).

Note, that result Schema will contain only "valid" properties (properties with get, set access, properties without IgnorePropertyAttribute)

Also, this method instantiates a Changes collection using created schema.

 

method DeriveSchema

 

void DeriveSchema()

 

Sub DeriveSchema()

ElementType    (declared in RemoteTableQuery<T>)

Returns a generic type for the current class instance.
For example, if the RemoteTableQuery<T> is instantiated like the RemoteTableQuery<Worker>, this property will return the type of the Worker class.

 

property ElementType: Type read;

 

Type ElementType { get; }

 

ReadOnly Property ElementType() As Type

Execute (Expression): Object

 

method Execute(expression: Expression): Object

 

Object Execute(Expression expression)

 

Function Execute(expression As Expression) As Object

Parameters:

  • expression:

Execute (Expression, array of DataParameter): Object

 

method Execute(expression: Expression; parameters: array of DataParameter): Object

 

Object Execute(Expression expression, DataParameter[] parameters)

 

Function Execute(expression As Expression, parameters As DataParameter()) As Object

Parameters:

  • expression:
  • parameters:

Expression    (declared in RemoteTableQuery<T>)

Returns the LINQ expression tree of the current instance.

 

property Expression: Expression read write;

 

Expression Expression { get; set; }

 

Property Expression() As Expression

GenExecute<S>

 

method GenExecute<S>(expression: Expression): S

 

S GenExecute<S>(Expression expression)

 

Function GenExecute<S>(expression As Expression) As S

Parameters:

  • expression:

GetEnumerable    (declared in RemoteTableQuery<T>)

Returns the result of a query execution as enumarable collection.
Implementation of the IRemoteTableQuery.

 

method GetEnumerable: IEnumerable

 

IEnumerable GetEnumerable()

 

Function GetEnumerable() As IEnumerable

GetEnumerator    (declared in RemoteTableQuery<T>)

Returns an enumerator of generic type through the result of the query execution.
Implementation of the System.Collections.IEnumerable.

 

method GetEnumerator: IEnumerator<T>

 

IEnumerator<T> GetEnumerator()

 

Function GetEnumerator() As IEnumerator<T>

GetEnumerator2    (declared in RemoteTableQuery<T>)

Similar to GetEnumerator(), with the difference that a result of this method is not connected with a generic type.

 

method GetEnumerator2: IEnumerator

 

IEnumerator GetEnumerator2()

 

Function GetEnumerator2() As IEnumerator

GetPropertiesWithRelation

Returns list of properties of class T that marked with RelationAttribute
Implementation of IRemoteTable.

 

method GetPropertiesWithRelation: array of PropertyInfo

 

PropertyInfo[] GetPropertiesWithRelation()

 

Function GetPropertiesWithRelation() As PropertyInfo()

GetQueryText

 

method GetQueryText(expression: Expression): String

 

String GetQueryText(Expression expression)

 

Function GetQueryText(expression As Expression) As String

Parameters:

  • expression:

InsertRow

Inserts the row that represents the provided object to the corresponding RemoteTable instance. This change will be applied to the remote database once the LinqDataAdapter.ApplyChanges method is called. This method returns the DeltaChange class, which represents the data table changes explained above. This object can be used if you need to set some of its properties manually.

 

method InsertRow(data: T): DeltaChange

 

DeltaChange InsertRow(T data)

 

Function InsertRow(data As T) As DeltaChange

Parameters:

  • data: Object whose representation should be inserted into the database.

MergeChanges

Merges delta changes of current table representation with its original data. Usually called after changes have been applied successfully on server-side.
Implementation of IRemoteTable

 

method MergeChanges

 

void MergeChanges()

 

Sub MergeChanges()

Provider    (declared in RemoteTableQuery<T>)

 

property Provider: IQueryProvider read;

 

IQueryProvider Provider { get; }

 

ReadOnly Property Provider() As IQueryProvider

RemoveChange

 

method RemoveChange(change: DeltaChange)

 

void RemoveChange(DeltaChange change)

 

Sub RemoveChange(change As DeltaChange)

Parameters:

  • change:

Schema

Represents the part of the Schema for the T-related table. It fills when creating an instance by using the Attributes of the T-class properties.
(Implementation of IRemoteTable)

 

property Schema: SchemaDataTable read;

 

SchemaDataTable Schema { get; }

 

ReadOnly Property Schema() As SchemaDataTable

TableName  protected

Table name retrieved from the TableNameAttribute of T type
(Implementation of the IRemoteTable)

 

property TableName: String read;

 

String TableName { get; }

 

ReadOnly Property TableName() As String

ToString

Returns string representation of T type

 

method ToString: String

 

String ToString()

 

Function ToString() As String

UpdateRow (T): DeltaChange

 

method UpdateRow(data: T): DeltaChange

 

DeltaChange UpdateRow(T data)

 

Function UpdateRow(data As T) As DeltaChange

Parameters:

  • data:

UpdateRow (T, T): DeltaChange

 

method UpdateRow(originalData: T; newData: T): DeltaChange

 

DeltaChange UpdateRow(T originalData, T newData)

 

Function UpdateRow(originalData As T, newData As T) As DeltaChange

Parameters:

  • originalData:
  • newData:

 

Changes

Gets a collection of DeltaChange items.

This collection maintains a list of inserted, deleted and updated rows in the DataTable. It is used internally by Data Adapter to send the modified data back to the server.

 

property Changes: Delta read;

 

Delta Changes { get; }

 

ReadOnly Property Changes() As Delta

DataAdapter

 

property DataAdapter: LinqDataAdapter read;

 

LinqDataAdapter DataAdapter { get; }

 

ReadOnly Property DataAdapter() As LinqDataAdapter

ElementType    (declared in RemoteTableQuery<T>)

Returns a generic type for the current class instance.
For example, if the RemoteTableQuery<T> is instantiated like the RemoteTableQuery<Worker>, this property will return the type of the Worker class.

 

property ElementType: Type read;

 

Type ElementType { get; }

 

ReadOnly Property ElementType() As Type

Expression    (declared in RemoteTableQuery<T>)

Returns the LINQ expression tree of the current instance.

 

property Expression: Expression read write;

 

Expression Expression { get; set; }

 

Property Expression() As Expression

Provider    (declared in RemoteTableQuery<T>)

 

property Provider: IQueryProvider read;

 

IQueryProvider Provider { get; }

 

ReadOnly Property Provider() As IQueryProvider

Schema

Represents the part of the Schema for the T-related table. It fills when creating an instance by using the Attributes of the T-class properties.
(Implementation of IRemoteTable)

 

property Schema: SchemaDataTable read;

 

SchemaDataTable Schema { get; }

 

ReadOnly Property Schema() As SchemaDataTable

TableName  protected

Table name retrieved from the TableNameAttribute of T type
(Implementation of the IRemoteTable)

 

property TableName: String read;

 

String TableName { get; }

 

ReadOnly Property TableName() As String

 

constructor    (declared in RemoteTableQuery<T>)

Default constructor that creates an instance of the RemoteTableQuery.

 

constructor

 

RemoteTable<T>()

 

Sub New()

constructor (IRemoteQueryProvider, Expression)    (declared in RemoteTableQuery<T>)

Creates a new instance of the RemoteTableQuery and associates it with a LINQ Expression and provider.

 

constructor(aProvider: IRemoteQueryProvider; aExpression: Expression)

 

RemoteTable<T>(IRemoteQueryProvider aProvider, Expression aExpression)

 

Sub New(aProvider As IRemoteQueryProvider, aExpression As Expression)

Parameters:

  • aProvider: Implementor of IRemoteQueryProvider that is able to execute aExpression.
  • aExpression: LINQ Expression appropriate to current instance.

constructor (LinqDataAdapter)

Creates a new instance of the RemoteTable class and processes the following:

  • Stores the reference for the parent dataAdapter
  • Sets the TableName property
  • Fills the Schema property according to the attributes of the type T.

 

constructor(dataAdapter: LinqDataAdapter)

 

RemoteTable<T>(LinqDataAdapter dataAdapter)

 

Sub New(dataAdapter As LinqDataAdapter)

Parameters:

  • dataAdapter: Data Adapter instance that will provide data and process changes of this RemoteTable instance

CancelChanges

 

method CancelChanges

 

void CancelChanges()

 

Sub CancelChanges()

CloneTable

 

method CloneTable(data: T): T

 

T CloneTable(T data)

 

Function CloneTable(data As T) As T

Parameters:

  • data:

CreateQuery

 

method CreateQuery(expression: Expression): IQueryable

 

IQueryable CreateQuery(Expression expression)

 

Function CreateQuery(expression As Expression) As IQueryable

Parameters:

  • expression:

CreateQuery<S>

 

method CreateQuery<S>(expression: Expression): IQueryable<S>

 

IQueryable<S> CreateQuery<S>(Expression expression)

 

Function CreateQuery<S>(expression As Expression) As IQueryable<S>

Parameters:

  • expression:

DeleteRow

Deletes the row that represents the provided object from the corresponding RemoteTable instance. This change will be applied to the remote database once the parent LinqDataAdapter.ApplyChanges method is called. This method returns the DeltaChange class, which represents the data table changes explained above. This object can be used if you need to set some of its properties manually.

 

method DeleteRow(data: T): DeltaChange

 

DeltaChange DeleteRow(T data)

 

Function DeleteRow(data As T) As DeltaChange

Parameters:

  • data: Object whose representation should be deleted from the database.

DeriveSchema  protected

Instantiates a 'Schema' property with new SchemaDataTable. This schema will be based on the T-type of current RemoteTable instance. Schema data is filled from field Attributes of T-class (such as FieldNameAttribute, DataTypeAttribute, etc).

Note, that result Schema will contain only "valid" properties (properties with get, set access, properties without IgnorePropertyAttribute)

Also, this method instantiates a Changes collection using created schema.

 

method DeriveSchema

 

void DeriveSchema()

 

Sub DeriveSchema()

Execute (Expression): Object

 

method Execute(expression: Expression): Object

 

Object Execute(Expression expression)

 

Function Execute(expression As Expression) As Object

Parameters:

  • expression:

Execute (Expression, array of DataParameter): Object

 

method Execute(expression: Expression; parameters: array of DataParameter): Object

 

Object Execute(Expression expression, DataParameter[] parameters)

 

Function Execute(expression As Expression, parameters As DataParameter()) As Object

Parameters:

  • expression:
  • parameters:

GenExecute<S>

 

method GenExecute<S>(expression: Expression): S

 

S GenExecute<S>(Expression expression)

 

Function GenExecute<S>(expression As Expression) As S

Parameters:

  • expression:

GetEnumerable    (declared in RemoteTableQuery<T>)

Returns the result of a query execution as enumarable collection.
Implementation of the IRemoteTableQuery.

 

method GetEnumerable: IEnumerable

 

IEnumerable GetEnumerable()

 

Function GetEnumerable() As IEnumerable

GetEnumerator    (declared in RemoteTableQuery<T>)

Returns an enumerator of generic type through the result of the query execution.
Implementation of the System.Collections.IEnumerable.

 

method GetEnumerator: IEnumerator<T>

 

IEnumerator<T> GetEnumerator()

 

Function GetEnumerator() As IEnumerator<T>

GetEnumerator2    (declared in RemoteTableQuery<T>)

Similar to GetEnumerator(), with the difference that a result of this method is not connected with a generic type.

 

method GetEnumerator2: IEnumerator

 

IEnumerator GetEnumerator2()

 

Function GetEnumerator2() As IEnumerator

GetPropertiesWithRelation

Returns list of properties of class T that marked with RelationAttribute
Implementation of IRemoteTable.

 

method GetPropertiesWithRelation: array of PropertyInfo

 

PropertyInfo[] GetPropertiesWithRelation()

 

Function GetPropertiesWithRelation() As PropertyInfo()

GetQueryText

 

method GetQueryText(expression: Expression): String

 

String GetQueryText(Expression expression)

 

Function GetQueryText(expression As Expression) As String

Parameters:

  • expression:

InsertRow

Inserts the row that represents the provided object to the corresponding RemoteTable instance. This change will be applied to the remote database once the LinqDataAdapter.ApplyChanges method is called. This method returns the DeltaChange class, which represents the data table changes explained above. This object can be used if you need to set some of its properties manually.

 

method InsertRow(data: T): DeltaChange

 

DeltaChange InsertRow(T data)

 

Function InsertRow(data As T) As DeltaChange

Parameters:

  • data: Object whose representation should be inserted into the database.

MergeChanges

Merges delta changes of current table representation with its original data. Usually called after changes have been applied successfully on server-side.
Implementation of IRemoteTable

 

method MergeChanges

 

void MergeChanges()

 

Sub MergeChanges()

RemoveChange

 

method RemoveChange(change: DeltaChange)

 

void RemoveChange(DeltaChange change)

 

Sub RemoveChange(change As DeltaChange)

Parameters:

  • change:

ToString

Returns string representation of T type

 

method ToString: String

 

String ToString()

 

Function ToString() As String

UpdateRow (T): DeltaChange

 

method UpdateRow(data: T): DeltaChange

 

DeltaChange UpdateRow(T data)

 

Function UpdateRow(data As T) As DeltaChange

Parameters:

  • data:

UpdateRow (T, T): DeltaChange

 

method UpdateRow(originalData: T; newData: T): DeltaChange

 

DeltaChange UpdateRow(T originalData, T newData)

 

Function UpdateRow(originalData As T, newData As T) As DeltaChange

Parameters:

  • originalData:
  • newData:

 

DA LINQ