Re: creating ExecuteQuery method
- From: "Andrus" <kobruleht2@xxxxxx>
- Date: Thu, 20 Mar 2008 18:51:18 +0200
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.
.
- References:
- creating ExecuteQuery method
- From: Andrus
- Re: creating ExecuteQuery method
- From: Marc Gravell
- Re: creating ExecuteQuery method
- From: Marc Gravell
- Re: creating ExecuteQuery method
- From: Andrus
- Re: creating ExecuteQuery method
- From: Marc Gravell
- Re: creating ExecuteQuery method
- From: Andrus
- Re: creating ExecuteQuery method
- From: Marc Gravell
- creating ExecuteQuery method
- Prev by Date: Re: objects disappear
- Next by Date: Re: Creating a User Control
- Previous by thread: Re: creating ExecuteQuery method
- Next by thread: Re: creating ExecuteQuery method
- Index(es):