With a MyGeneration generated dOOdad you can easily perform the operation as shown below (having not yourself written a line of code to make the underlying code work)
- Code: Select all
'VB.NET Syntax
Dim emp as Employee = new Employee
emp.Where.LastName.Op = Operator.Like
emp.Where.LastName.Value = \"%A%\"
emp.Where.Age.Value = 40
emp.Where.Age.Op = Operator.GreaterThan
emp.Query.Top = 5
' The default is all columns unless you explicitly set them
emp.Query.ResultColumnsAdd(Employee.Columns.LastName)
emp.Query.ResultColumnsAdd(Employee.Columns.FirstName)
emp.Query.AddOrderBy(Employee.Columns.LastName)
Emp.Query.Load()
This will load all Employees who have a 'A' in their last name and are over 40 years old. It will bring back only the LastName and FirstName columns, but only the first 5 records, finally it will order the rows by LastName. You will find you write very few stored procedures, when you modify your tables you have no stored procedures to manually maintain.
Like our current sample business objects, LoadAll(), LadByPrimaryKey(), AddNew() all still exist, along with the Save() logic and properties.
However, here are some of the new features:
- Seamless transaction support which will allow you to save any number of business entities within a single transaction (the business entities aren’t even aware of the transaction)
Filter and Sort are fully supported on the business entities and enumeration of the collection respects the values you have set in both Filter and Sort.
A few more goodies we’ll save for Friday.
On Friday the VB.NET architecture will be published, initially for SqlClient only. However, C# will follow within the following week. Access folks, we will have this solution for you soon as well.
Please post a note here if you plan to evaluate this new architecture.
