See our latest blog POST
Also, there will be more coming up on this, such as ....
Code:
public Form1()
{
InitializeComponent();
dataContext = new DataContext("User ID=sa;password=griffinski;Initial Catalog=ForeignKeyTest;Data Source=GRIFFO;");
Test_LINQ();
long start = System.Environment.TickCount;
for (int i = 0; i < 1000; i++)
{
Test_LINQ();
}
long end = System.Environment.TickCount;
long time = (end - start);
}
void Test_LINQ()
{
var employees = dataContext.GetTable();
var query = from employee in employees where employee.Age < 50 && employee.Age > 10 select employee;
foreach (Employee emp in query)
{
}
}
This is some test code I ran but didn't yet publish. Both Test_LINQ() and Test_EntitySpaces() are returning the same EntitySpaces classes from the same table using the same connection string. I call each once to avoid any first time loading issues before the tests begin.
The SQL generated by Test_LINQ() is as follows:
Code:
SELECT [t0].[EmployeeID], [t0].[LastName], [t0].[FirstName], [t0].[Age], [t0].[Supervisor]
FROM [Employee] AS [t0]
WHERE ([t0].[Age] < @p0) AND ([t0].[Age] > @p1
The first three times for Test_LINQ() were as follows (milliseconds) 2484, 2734, 2578
Now, I changed the calls to Test_LINQ() to Test_EntitySpaces() which looks like this:
Code:
void Test_EntitySpaces()
{
EmployeeCollection coll = new EmployeeCollection();
coll.Query.Where(coll.Query.Age < 50 & coll.Query.Age > 10);
coll.Query.Load();
foreach (Employee emp in coll)
{
}
}
The SQL generated by Test_EntitySpaces is as follows:
Code:
SELECT *
FROM [Employee]
WHERE ([Age] < @Age1 AND [Age] > @Age2)
The first three times for Test_EntitySpaces() were as follows (milliseconds) 375, 375, 391
Of course, our EntitySpaces API works on .NET 2.0 and up, mono, the Compact Framework, Medium Trust, and requires zero reflection. Also, it runs on Microsoft SQL, Oracle, MySQL, PostgreSQL, VistaDB, Microsoft Access, and Microsoft SQL CE now ...
EntitySpaces |
Twitter |
BLOG | Please honor our Software License