Hi people!

Cassio, check the additional code described in

http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1-using-the-linq-dynamic-query-library.aspx

I use some of this in my example
http://ajlopez.wordpress.com/2009/01/30/dynamic-expressions-example/
there are more links there, pointing to other implementation

There is a Codeplex project, simplifyng the build of a QueryProvider, not
related with your question, but it could be interesting. I guess NHibernate
devs were using it to build the new Linq implemented in NH

Angel "Java" Lopez
http://www.ajlopez.com
http://twitter.com/ajlopez


On Fri, Mar 5, 2010 at 4:40 PM, Ken Egozi <[email protected]> wrote:

> you could either look up c# parser and lexer codes, and tweak to your
> needs. Maybe look at Mono's c# compiler.
> that is however non trivial work.
>
> you can also wrap the text with a valid c# class and method declarations,
> then use a CodeDomProvider.CompileAssemblyFromSource() to get an assembly,
> lookup your new type, and invoke the new method.
>
>
> On Fri, Mar 5, 2010 at 9:23 PM, CassioT <[email protected]> wrote:
>
>> Hi all. This is an NH off topic but it is C# and programming anyway.
>>
>> Let's suppose:
>>
>> var blog = dao.GetBlog(1); //Blog has posts
>>
>> string s = "blog.Posts.Sum(p => p.NumOfVisitors)";
>>
>> or
>>
>> string s = "Posts.Sum(p => p.NumOfVisitors)"; // considering blog as
>> the root object
>>
>> What is the best way to translate this string in code dynamically?
>> This is only a simple example but it is near of what I want.
>>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>
>
> --
> Ken Egozi.
> http://www.kenegozi.com/blog
> http://www.delver.com
> http://www.musicglue.com
> http://www.castleproject.org
> http://www.idcc.co.il - הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to