EasyObjects.NET Programmers Reference

EasyObject.QuerySource Property

Used to set an alternate query source (such as a view) when building dynamic queries.

public virtual string QuerySource {get; set;}

Remarks

It is not necessary to load an EasyObject from the same table source. In fact, you can load an EasyObject from any table or view. However, not all of the strongly typed properties and methods are guaranteed to work it the query source is extremely divergent from the original table.

Example

VB.NET

Dim emps As New Employees

' Load the object from a view instead of the table
emps.QuerySource = "EmployeeDetailView"

' Only return the EmployeeID and LastName
emps.Query.AddResultColumn(EmployeesSchema.EmployeeID)
emps.Query.AddResultColumn(EmployeesSchema.LastName)

' Order by a column in the view but not the Employee table
emps.Query.AddOrderBy("DateCertified", WhereParameter.Dir.ASC)

emps.Query.Load()
C#
Employees emps = new Employees();

// Load the object from a view instead of the table
emps.QuerySource = "EmployeeDetailView";

// Only return the EmployeeID and LastName
emps.Query.AddResultColumn(EmployeesSchema.EmployeeID);
emps.Query.AddResultColumn(EmployeesSchema.LastName);

// Order by a column in the view but not the Employee table
emps.Query.AddOrderBy("DateCertified", WhereParameter.Dir.ASC);

emps.Query.Load();

See Also

EasyObject Class | NCI.EasyObjects Namespace