Keep the HQL, that's easy to serialize (string).
You can cache the LINQ query too, but no need to serialize it. Just
cache it in the app domain and rebuild it from HQL when needed. That
will make it a lot easier.

I still think converting HQL to LINQ is much harder than you believe.
After all, it's just what NH's LINQ provider does, just the other way
around. That was a lot of work, still in progress!

HTH,
Stefan

On 19 Nov., 02:22, Throckmorton <[email protected]> wrote:
> Yeah, is sounds like this is would be a big job.
> I am going to look into implementing a poor-man's query engine for the
> entity cache:
> for each HQL query, work out a matching LINQ query and serialize it in
> the L2 cache. This could be done
> using dynamic LINQ, using a string, which should be not impossible to
> serialize :)
>
> Then, use this LINQ to query the database.
>
> It would be real nice to automatically generate the LINQ, but one must
> choose one's battles.
>
>   --Jorge
>
> On Nov 18, 3:19 am, Stefan Wenig <[email protected]> wrote:
>
>
>
> > do what exactly? I suppose you're not talking serialize/deserialize
> > HQL? ;-)
>
> > convert HQL or IQueryable to LINQ 2 objects? execute HQL in memory?
> > couldn't find it in their docs.
>
> > On 17 Nov., 12:19, Fabio Maulo <[email protected]> wrote:
>
> > > WebORBhttp://www.themidnightcoders.com/develop-ria/guided-tour/
> > > <http://www.themidnightcoders.com/develop-ria/guided-tour/>do the same 
> > > with
> > > HQL
>
> > > On Wed, Nov 17, 2010 at 5:52 AM, Stefan Wenig 
> > > <[email protected]>wrote:
>
> > > > I was just going off on a tangent. AFAIK, what you describe cannot be
> > > > done, unless somebody comes and builds it. Wouldn't hold my breath
> > > > though, HQL was not built for in-memory execution.
>
> > > > I'd rather go look for a way to serialize in-memory LINQ queries.
>
> > > >http://stackoverflow.com/questions/4036489/what-is-the-easiest-way-to...
>
> > > > Also, Silverlight RIA toolkit has code that does that. For remote
> > > > invocation, not storage, but hey...
> > > > problems:
> > > > - in RIA toolkit, serialization (client) and deserialization (server)
> > > > use similar, but different types.
> > > > - if you compile an IQueryable expression, it will compile to the
> > > > IQueryable and Queryable extension methods. you'd need to replace that
> > > > with IEnumerable and Enumerable extension methods so that they
> > > > actually do the work instead of just creating expression trees again.
>
> > > > Other stuff might be available. Tell us if you find a way!
>
> > > > HTH,
> > > > Stefan
>
> > > > On 16 Nov., 21:12, Throckmorton <[email protected]> wrote:
> > > > > Wait a second, I'm confused.
>
> > > > > a) I start with an HQL query, which is just a string.
> > > > > b) NH is designed to apply this HQL to a database, by first converting
> > > > > to ANTLR
> > > > > c) I want to apply the HQL to an in-memory collection instead
> > > > > d) so, I could use the LINQ equivalent, if it can be generated from
> > > > > the HQL
> > > > > e) since LINQ and HQL get converted to ANTLR expression, I would need
>
> > > > > HQL ==> ANTLR ===> LINQ
>
> > > > > f) this may be currently impossible
>
> > > > > On Nov 16, 11:12 am, Stefan Wenig <[email protected]> wrote:
>
> > > > > > You're right, I skipped a step. I once asked steve strong whether he
> > > > > > could emit the HQL as a string for diagnostics. He said: easily. 
> > > > > > (much
> > > > > > easier than serializing and deserializing LINQ in any case...)
>
> > > > > > but anyway, I digress.
>
> > > > > > On 15 Nov., 11:55, Stefan Wenig <[email protected]> wrote:
>
> > > > > > > BTW, internally, LINQ is converted to HQL. There might be a way to
> > > > > > > extract, save and execute this HQL.
>
> > > > > > > On 13 Nov., 20:06, Jorge <[email protected]> wrote:
>
> > > > > > > > yeah, I guess I will store a linq query along with the HQL.
> > > > > > > > Problem is, LINQ cannot be serialized to disk, while HQL can.
> > > > > > > > So, if HQL could be converted to LINQ, then this would be the
> > > > nicest
> > > > > > > > solution.
>
> > > > > > > > On Nov 13, 8:09 am, Jason Meckley <[email protected]> 
> > > > > > > > wrote:
>
> > > > > > > > > that would be linq then :)
>
> > > > > > > > > On Nov 12, 8:22 pm, Jorge <[email protected]> wrote:
>
> > > > > > > > > > Hello!
> > > > > > > > > > Is it possible to take an HQL query and apply it to a
> > > > collection of
> > > > > > > > > > entities in memory?
> > > > > > > > > > Something similar to LINQ?
>
> > > > > > > > > > Thanks!
> > > > > > > > > > Jorge- Zitierten Text ausblenden -
>
> > > > > > > > - Zitierten Text anzeigen -- Zitierten Text ausblenden -
>
> > > > > > > - Zitierten Text anzeigen -- 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.
>
> > > --
> > > Fabio Maulo- Zitierten Text ausblenden -
>
> > > - Zitierten Text anzeigen -- 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].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to