Namespace - LJCDBMessage
Syntax
C# |
public class DbJoins : List<DbJoin>
|
Represents a collection of table joins.
(E)
Remarks
The common collection static method is HasItems()
The collection contains a copy constructor.
The common collection instance methods are: Add() and Clone().
Constructor
#ctor
|
Initializes an object instance. |
#ctor
|
The Copy constructor. |
Collection
Add
|
Creates the element from the supplied values and adds it to the collection. |
Clone
|
Clones the structure of the object. |
4 Methods
Example
C# |
using LJCNetCommon;
using LJCDBMessage;
public class Person
{
public Int32 PersonId { get; set; }
public string Name { get; set; }
public string City { get; set; }
}
DbJoins dbJoins = new DbJoins();
dbJoin = new DbJoin()
{
TableName = "Address",
JoinType = "Left"
};
DbJoinOns dbJoinOns = new DbJoinOns();
DbJoinOn dbJoinOn = new DbJoinOn()
{
FromColumnName = "ID",
ToColumnName = "PersonID",
JoinOnOperator = "=" // Default
};
dbJoinOns.Add(dbJoinOn);
dbJoin.JoinOns = dbJoinOns;
DbColumns columns = new DbColumns();
DbColumn column = new DbColumn()
{
ColumnName = "City_Name",
PropertyName = "City", // Defaults to same as ColumnName
DataTypeName = "String" // Default
};
columns.Add(column);
dbJoin.Columns = columns;
dbJoins.Add(dbJoin);
DbJoins dbJoins = new DbJoins();
dbJoin = new DbJoin()
{
TableName = "Address",
JoinOns = new DbJoinOns() {
{ "ID", "PersonID" }
},
Columns = new DbColumns() {
{ "City_Name", "City" }
}
};
dbJoins.Add(dbJoin);
DbRequest dbRequest = new DbRequest("Select", "Person")
{
DataConfigName = "PersonData",
Columns = new DbColumns() { { "Name" }},
Joins = dbJoins
};
|
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.