Re: creating ExecuteQuery method
- From: Marc Gravell <marc.gravell@xxxxxxxxx>
- Date: Sat, 22 Mar 2008 02:31:13 -0700 (PDT)
So they use some other way, no idea how.A simple approach would be an initializer Expression created at
runtime. Activator.CreateInstance would work but would be slower.
Alternatively, simply use reflection to invoke a private metod that
*does* have the constraint (when the public method doesn't) - then it
only gets checked once.
They also allow to maps results directly to fields.Read your OP; you asked about properties... I maintain that the sample
did most of what you asked!
Again - an initializer Expression would be a simple fix here. This
would also address the issue with value-types, since inside the
Expression (once compiled to a delegate) it would be using direct
member access, not Reflection nor ComponentModel. Also much faster.
MS doc does not describe RO property behaviour.Fine - but a more deliberate attempt to check up-front an raise a
So I'm not sure maybe ro property can considered as programmer error. In
this case it is not reasonable to ignore it silently.
specific error would be good practice.
Yes this will match more closely to Linq-SQL.I don't know about the mapping process that the open-source code uses,
I do'nt now how to implement it, so this remains unresolved issue by me.
so I can't advise. However the actual process is simple.
I'll tell you what. I'm having a bit of a family weeked (4 day weekend
here ;-p) - but on Tuesday I'll rewrite my sample using
System.Expression to show the alternative construction. How's that?
Note that Expression *absolutely* precludes dynamic object models. The
two concepts are not compatible (I'm sure we've discussed this
before).
Marc
.
- Follow-Ups:
- Re: creating ExecuteQuery method
- From: Marc Gravell
- Re: creating ExecuteQuery method
- 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
- Re: creating ExecuteQuery method
- From: Andrus
- Re: creating ExecuteQuery method
- From: Marc Gravell
- Re: creating ExecuteQuery method
- From: Andrus
- creating ExecuteQuery method
- Prev by Date: Implementing Linq IENumerable<T> without new() constraint
- Next by Date: Re: How to implement my array/collection
- Previous by thread: Re: creating ExecuteQuery method
- Next by thread: Re: creating ExecuteQuery method
- Index(es):
Loading