These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Strongly typed list
PostPosted: Thu Oct 16, 2008 10:58 am 
Beginner
Beginner

Joined: Fri Feb 29, 2008 9:36 am
Posts: 40
Hi,

I try to get a strongly typed list form NHibernate but my code return null.

Code:
public class TestsList : List<TestsEntity> { }

static NHibernate.ICriteria Crit(NHibernate.ISession session)
{
    return session.CreateCriteria(typeof(TestsEntity));
}

internal static TestsList Tests(NHibernate.ISession session)
{
    return Crit(session).List<TestsEntity>() as TestsList;
}


Please, what's the good syntax to get a TestsList() as return function ?

Papy !


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2008 11:28 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Code:
internal static TestsList Tests(NHibernate.ISession session)
{
    TestsList result = new TestsList();
    Crit(session).List(result);
    return result;
}

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2008 12:10 pm 
Beginner
Beginner

Joined: Fri Feb 29, 2008 9:36 am
Posts: 40
IT work very well !

A great thanks !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.