Re: creating ExecuteQuery method



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.
So I'm not sure maybe ro property can considered as programmer error. In
this case it is not reasonable to ignore it silently.
Fine - but a more deliberate attempt to check up-front an raise a
specific error would be good practice.

Yes this will match more closely to Linq-SQL.
I do'nt now how to implement it, so this remains unresolved issue by me.
I don't know about the mapping process that the open-source code uses,
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
.


Loading