Re: creating ExecuteQuery method

Tech-Archive recommends: Speed Up your PC by fixing your registry



MArc,

I'd like easily to visualise any SELECT command results for quick design
in scripts in customer sites like <snip>

Sounds like DataTable would do this job perfectly well. I'm a
pragmatist... why make life hard?

DLinq uses only DataReader. There are no any DataTable objects.

So this requires to switch back to DataTable and ADO .NET FillDataSet()
methods.
Entity methods require POCO type objects. DataTable rows do not fill into
this category: row columns are not properties. They do not have getters and
setters and cannot instantiated without DataTable.

So DataRow cannot used as replacement of entity POCO type.

So only way is to create type dynamically.

At the end of the day, <T> implies a known data structure (of type T) -
not "make it up yourself"...

Yes, it is not reasonable to use ExecuteQuery<TResult>() method.

For this we must create non-generic ExecuteQuery() method which returns
ArrayList of entity objects.
This also fixes the lack of covariant generic types in C#.

I.e in C# 4:

ArrayList Orders = ExecuteQuery("SELECT * FROM Customers JOIN Orders USING
(Id)");
dynamic {
Orders.Amout += 10;
}

in 3.5 we can use reflection instead of dynamic.

Andrus.


.