[nhusers] NHibernate Projections - how to project collections?

2012-05-13 Thread Chuck Boyde
Have a scenario where I need to only select a few properties from an entity, but also collections. This seems such a normal situation, yet cannot find info on projecting collections - only properties. Customer customerAlias = null; Order orderAlias = null; var list = _session.QueryOver(() => cust

[nhusers] Re: QueryOver projections - how to project collections to DTO

2012-05-10 Thread Chuck Boyde
the blog and comments > query in 1 sql statement. > > > > > > > > On Thu, May 10, 2012 at 10:20 AM, Chuck Boyde wrote: > > I am trying to project a collection of an entity into a DTO. Easy > > enough with simple properties, but having an issue with collections: >

[nhusers] QueryOver projections - how to project collections to DTO

2012-05-10 Thread Chuck Boyde
I am trying to project a collection of an entity into a DTO. Easy enough with simple properties, but having an issue with collections: public class Blog { public string Name {get;set;} public IList Comments {get;set;} //... more properties } public class Comments { public Blog Blog {ge

[nhusers] Need some advice on a nh linq query

2011-08-24 Thread Chuck Boyde
Any advice on how to get a SQL query similar to the following using linq. select Competitions.Id, Competitions.Name, COUNT(Contestants.Id) as Entries, SUM(CASE WHEN Contestants.Gender = 'male' THEN 1 ELSE 0 END) as Males, SUM(CASE WHEN Contestan

[nhusers] Caching not working for associated entities unless specified in mapping file

2010-08-24 Thread Chuck Boyde
I am having a problem getting associated entities to be cached unless they are specified (Not.LazyLoad() in mapping). If I build up a query in Criteria or Linq the Main Entity is cached, but not associated entities. IList news; using (var session = factory.OpenSession())

[nhusers] Re: Where Are You From?

2010-03-04 Thread Chuck Boyde
Cape Town - South Africa On Mar 3, 5:03 pm, spiralni wrote: > Will be interesting to see where all nhusers lives.. > > @Cesar Sanz: Nicaragua -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhus...@googlegro

[nhusers] Problem with nhibernate linq Expand() statements results not being cached with rest of results

2010-03-02 Thread Chuck Boyde
Some more cache related problems. I am having a problem getting the results of associated or child entities to be loaded into the nhibernate cache along with the root entity when using the Expand() method. The root entity loads fine though. So the following: var query = session.Linq();

[nhusers] Re: nhibernate caching entities but not query

2010-03-01 Thread Chuck Boyde
//var p = query.OrderBy(x => x.Name).Select(x=>x).ToList();// will hit the db } On Feb 28, 11:44 pm, Chuck Boyde wrote: > Just downloaded latest build of Linq and same problem. Here is the > test: > > [Test] >         public void Can_Cache() &g

[nhusers] Re: nhibernate caching entities but not query

2010-02-28 Thread Chuck Boyde
Fabio Maulo wrote: > what is in cache is the result of the query not the single entity > > 2010/2/27 Chuck Boyde > > > > > Hi all > > > I have come across a problem and don't believe this is by design. I am > > unable to get nhibernate to use the cach

[nhusers] Re: nhibernate caching entities but not query

2010-02-28 Thread Chuck Boyde
Feb 28, 4:23 pm, Fabio Maulo wrote: > The cache can be invalidated in some moment because: > 1) the cache conf. say "invalidate after N seconds" (default N 5 seconds) > 2) query space was "touched" by an insert/delete/update > > 2010/2/28 Chuck Boyde > > &g

[nhusers] Re: nhibernate caching entities but not query

2010-02-28 Thread Chuck Boyde
iteLine("Fourth Query"); >                var query = session.Linq(); >                query.QueryOptions.SetCachable(true); >                query.QueryOptions.SetCacheMode(CacheMode.Normal); >                var p = query.Select(x => x).ToList(); >            } >

[nhusers] Re: nhibernate caching entities but not query

2010-02-28 Thread Chuck Boyde
query.QueryOptions.SetCachable(true); query.QueryOptions.SetCacheMode(CacheMode.Normal); var p = query.Select(x => x).ToList(); } } On Feb 27, 10:49 pm, Fabio Maulo wrote: > what is in cache is the result of the query not the single entity >

[nhusers] nhibernate caching entities but not query

2010-02-27 Thread Chuck Boyde
Hi all I have come across a problem and don't believe this is by design. I am unable to get nhibernate to use the cache when using a query like: var acc = session.CreateQuery("from Account").SetCacheable(true).List(); I have set the following in the config: NHibernate.Cache.HashtableCacheProvi

[nhusers] Lazy Loading within a MVC View

2010-01-15 Thread Chuck Boyde
Hi All How do I keep a session available to my view to enable lazy loading of entities. For example: We have a Customer with Orders and Orders have Order Lines. In my controller I want get all my customers and pass the entity to my view. In the view a request may be made to the orders at which poi

[nhusers] Multiple levels of inheritance

2009-06-29 Thread Chuck Boyde
I am busy modeling a financial transaction system. In this system I have types of financial transactions like payments (representing purchases of an item) & refunds. Simple for this example. I have modeled the domain like this so far: Payment abstract class, inheriting from FinancialTransaction