Sure, I agree with you Fabio but please read the second mail of Cassio.

2010/3/7 Fabio Maulo <[email protected]>

> I'm sorry José...
> but if you can work with strings the best way to wary your domain is HQL
>
> 2010/3/7 José F. Romaniello <[email protected]>
>
>> dynamic linq is a ***.
>> Why do you wan that? Who defines that string?
>>
>> instead of concatenating strings to make your query you can create an
>> expression with:
>>
>> Expression.Parameter()
>> Expression.Property()
>> Expression....
>>
>>
>>
>>
>> 2010/3/7 Stefan Wenig <[email protected]>
>>
>> Hi
>>>
>>> so you want to use LINQ 2 objects (the IEnumerable version), not LINQ
>>> 2 NH?
>>> In any case, Dynamic LINQ only provides parsing of Where etc. clauses,
>>> not entire queries. So this is only a complete solution if the
>>> structure of your query is alreay known at compile time and users just
>>> enter conditions etc. DL is not using lamda notation, BTW, so I don't
>>> know how multiple sources are referred to in more complex queries
>>> (might not be supported at all, need to check).
>>> I'd try dynamic compilation, that shouldn't be too hard. (CodeDOM can
>>> help with compilation and even generate boiler plate code for any
>>> supported language.) Use the #line directive to get useful error
>>> messages. You have to take care of assembly loading though, and you
>>> can't unload them anymore. (There's been talk about straight type/
>>> assembly unloading support in .NET 4, but I didn't check). Using
>>> separate AppDomains is going to be a problem, especially if you want
>>> to execute the query in memory (you can hardly pass the entire object
>>> graph via remoting/serialization). Using Mono C# to compile to dynamic
>>> methods would be cool, but it'd be a lot of work, and would not work
>>> for queries that generate types (anonymous types or - implicitly - via
>>> transparent identifiers).
>>>
>>> VB10 was rumored to have REPL-support, so if you can wait for that and
>>> accept VB syntax, check out the RC. If that's not an option and you
>>> need unloading, I'd look at HQL again.
>>>
>>> Let us know how you solved that one! Support for user-provided LINQ is
>>> definitely an interesting feature.
>>>
>>> Stefan
>>>
>>> On 6 Mrz., 16:32, CassioT <[email protected]> wrote:
>>> > Because I already have the object graph and I don't want to hit the
>>> > database again.
>>> >
>>> > I used a DAO to get the first object only to give you a scenario, but
>>> > the real code is not like that.
>>> >
>>> > But even if it was the case I would chose LINQ. The string will be
>>> > written in the UI and I don't want HQL (or even SQL) in the UI. I want
>>> > it to be technology independent. That's why LINQ to NH is so waited.
>>> >
>>> > Thanks all replies.
>>> >
>>> > On Mar 5, 7:09 pm, Mohamed Meligy <[email protected]> wrote:
>>> >
>>> >
>>> >
>>> > > If you are using strings, why not use HQL directly? Then life should
>>> be
>>> > > pretty much more straight forward.
>>> > > Dynamic LINQ library (referred by Angel) is also great, and many
>>> tried it
>>> > > successfully.
>>> >
>>> > > --
>>> > > Mohamed Meligy
>>> > > Senior Developer, Team Lead Backup (.Net Technologies - TDG -
>>> Applications)
>>> > > Injazat Data Systems
>>> > > P.O. Box: 8230 Abu Dhabi, UAE.
>>> >
>>> > > Phone:  +971 2 6992700
>>> > > Direct:   +971 2 4045385
>>> > > Mobile:  +971 50 2623624, +971 55 2017 621
>>> >
>>> > > E-mail: [email protected]
>>> > > Weblog:http://gurustop.net
>>> >
>>> > > On Fri, Mar 5, 2010 at 9:53 PM, Angel Java Lopez <
>>> [email protected]>wrote:
>>> >
>>> > > > Hi people!
>>> >
>>> > > > Cassio, check the additional code described in
>>> >
>>> > > >
>>> http://weblogs.asp.net/scottgu/archive/2008/01/07/dynamic-linq-part-1...
>>> >
>>> > > > 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]>
>>> <nhusers%[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]>
>>> <nhusers%[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]<nhusers%[email protected]>
>>> <nhusers%[email protected]<nhusers%[email protected]>>
>>> > > > .
>>> > > > For more options, visit this group at
>>> > > >http://groups.google.com/group/nhusers?hl=en.- Zitierten Text
>>> ausblenden -
>>> >
>>> > - Zitierten Text anzeigen -
>>>
>>> --
>>> 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]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>
>
>
> --
> Fabio Maulo
>
>  --
> 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