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] > >>> > > >>> . > >>> 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]<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.
