Yes, you’re right! That has no sense at all!

 

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Tuna Toksöz
Sent: Sunday, October 05, 2008 18:36
To: [email protected]
Subject: [nhibernate-development] Re: MultiCriteria, MultiQuery needs some
modifications

 

Nope, batch query will probably not have

      object UniqueResult();

      T UniqueResult<T>();

because it is a multi-query. So it should be another class that doesn't
inherit from INhQuery

 

List and UniqueResult, hmm maybe. I am thinking on Linq queries and yes this
may have List that refers to .ToList() and UniqueResult() to .First()

 

 

On Mon, Oct 6, 2008 at 12:26 AM, Diego Jancic <[EMAIL PROTECTED]> wrote:

Hi,

I've an idea that sounds more intuitive to me. The problem is that I would
expect to be able to do something like:

 

INHQuery query = GiveMeAQueryUsingTheMethodYouWant();

query.List()

 

Because a query is useless if I can't see the results, I think that the
INHQuery should be at least something like this:

 

interface INhQuery

{

      object List();

      IList<T> List<T>();

      object UniqueResult();

      T UniqueResult<T>();

 

      // As we are in NHibernate and not in ADO.NET, and the Caching feature
is

      // in the core of the framework, I would add the caching methods too. 

}

 

Also, the batcher is not an special class alone, it could be just another
INhQuery that contains INhQueries. Something like this:

 

class BatchQuery : INhQuery

{

      void AddQuery(INhQuery query);

 

      // Methods from INhQuery:

      object List();

      IList<T> List<T>();

      object UniqueResult();

      T UniqueResult<T>();

}

 

Of course the BatchQuery could be an interface instead of a concrete class,
but I don't see why it might be needed. Of course you know so much better
how NH works, and probably have several reasons for that. It's just an idea.

Thoughts?

 

Diego

 

From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Tuna Toksöz
Sent: Sunday, October 05, 2008 12:40
To: [email protected]
Subject: [nhibernate-development] Re: MultiCriteria, MultiQuery needs some
modifications

 

No other thoughts?

On Sat, Oct 4, 2008 at 11:10 PM, Tuna Toksöz <[EMAIL PROTECTED]> wrote:

Doesn't have to have any method, a marker interface just works. But if we
are to define, then we can use 

 

interface INhQuery

{

      void SetCachable(bool);

     void SetCacheRegion(string);

     void SetCacheMode(whatever);

}

 

Those are the biggest set of methods that are common among Hql,Criteria and
Linq(in the future)

On Sat, Oct 4, 2008 at 11:00 PM, Fabio Maulo <[EMAIL PROTECTED]> wrote:

Which should be the contract of INhQuery ?

2008/10/4 Tuna Toksöz <[EMAIL PROTECTED]> 

 

Hello everybody, 
 
When studying the issue NH-1508 <http://jira.nhibernate.org/browse/NH-1508>
, I realized that MultiQuery is coupled to Hql(Sql is not possible). Fabio
told me to throw NotSupportedException temporarily, just to let the user
know about the situation. 
The discussion between Fabio and me brought some ideas in my mind. 
 
Let me tell what I have in my mind. 
 
1. Define an interface INHQuery (a better name would be IQuery but it is
used for Hql) which will be base for IQuery and ICriteria, and in the future
Linq Queries. Can be either a marker interface or a set of common methods
such as cacheable etc. This part is optional)
2. Define a Batcher class(I need to study NH more to come up with full
declaration) and an interface IBatchQueryAppender<T> where T:INhQuery
    The batcher will accept any INhQuery as long as its Appender is defined.
It will do the work to append the query to the batch.

This way, different querying methods can be used in the same batch.
 
This implementation will make MultiQuery and MultiCriteria obselete and
current implementations for those will redirect method calls to INhQuery in
order to prevent breaking changes.
 
This is my initial thoughts about the issue. Comments are welcome.
 
Cheers!
-- 
Tuna Toksöz

Typos included to enhance the readers attention




-- 
Fabio Maulo




-- 
Tuna Toksöz

Typos included to enhance the readers attention!




-- 
Tuna Toksöz

Typos included to enhance the readers attention!




-- 
Tuna Toksöz

Typos included to enhance the readers attention!

Reply via email to