DynamicQuery allows you to build provider independent dynamic queries against the database from outside your data layer. All selection criteria are passed in via Parameters in order to prevent sql injection techniques often attempted by hackers.
For a list of all members of this type, see DynamicQuery Members.
System.Object
Microsoft.Practices.EnterpriseLibrary.Configuration.ConfigurationProvider
NCI.EasyObjects.DynamicQuery
NCI.EasyObjects.DynamicQueryProvider.OracleDynamicQuery
NCI.EasyObjects.DynamicQueryProvider.SqlServerDynamicQuery
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
VB.NET
Dim emps As New Employees ' LastNames that have "A" anywher in them emps.Where.LastName.Value = "%A%" emps.Where.LastName.Operator = WhereParameter.Operand.Like_ ' Only return the EmployeeID and LastName emps.Query.AddResultColumn(EmployeesSchema.EmployeeID) emps.Query.AddResultColumn(EmployeesSchema.LastName) ' Order by LastName ' (you can add as many order by columns as you like by repeatedly calling this) emps.Query.AddOrderBy(EmployeesSchema.LastName, WhereParameter.Dir.ASC) ' Bring back only distinct rows emps.Query.Distinct = True ' Bring back the top 10 rows emps.Query.TopN = 10 emps.Query.Load()C#
Employees emps = new Employees(); // LastNames that have "A" anywher in them emps.Where.LastName.Value = "%A%"; emps.Where.LastName.Operator = WhereParameter.Operand.Like; // Only return the EmployeeID and LastName emps.Query.AddResultColumn(EmployeesSchema.EmployeeID); emps.Query.AddResultColumn(EmployeesSchema.LastName); // Order by LastName // (you can add as many order by columns as you like by repeatedly calling this) emps.Query.AddOrderBy(EmployeesSchema.LastName, WhereParameter.Dir.ASC); // Bring back only distinct rows emps.Query.Distinct = true; // Bring back the top 10 rows emps.Query.TopN = 10; emps.Query.Load();
Namespace: NCI.EasyObjects
Assembly: NCI.EasyObjects (in NCI.EasyObjects.dll)
DynamicQuery Members | NCI.EasyObjects Namespace