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.  [ 8 posts ] 
Author Message
 Post subject: Benefits of Generics in .net 2.0
PostPosted: Wed Jun 28, 2006 6:36 am 
Newbie

Joined: Mon Jun 26, 2006 3:20 pm
Posts: 15
Can anyone 'breifly' and that being the key word, list advantages on upgrading to NHibernate 1.2 and usingGenerics over NH 1.1

I'm currently using NH 1.1 with .net 2.0 and it works fine, should I upgrade?

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 28, 2006 7:49 am 
Regular
Regular

Joined: Wed Jun 21, 2006 3:13 pm
Posts: 110
you can also use generics in NH 1.0.1 with an external assembly http://www.ayende.com/projects/nhibernate-query-analyzer/generics.aspx.


Top
 Profile  
 
 Post subject: Re: Benefits of Generics in .net 2.0
PostPosted: Thu Jun 29, 2006 9:17 am 
Newbie

Joined: Mon Jun 26, 2006 12:27 pm
Posts: 16
redtap wrote:
Can anyone 'breifly' and that being the key word, list advantages on upgrading to NHibernate 1.2 and usingGenerics over NH 1.1

I'm currently using NH 1.1 with .net 2.0 and it works fine, should I upgrade?

Thanks!


Just to clarify are you asking for the advantages of generics in general, or the advantages of using NHIbernate's support for generics?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 7:05 am 
Newbie

Joined: Mon Jun 26, 2006 3:20 pm
Posts: 15
What are the benefits using...

http://www.ayende.com/projects/nhiberna ... erics.aspx

over not using it? and are they massive benefits?

Because I find using it kinda confusing...

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 3:38 pm 
Beginner
Beginner

Joined: Tue May 17, 2005 7:25 pm
Posts: 43
Location: Somewhere, USA
Don't forget that NHibernate 1.2 also includes the new lightweight code generation implementation for the reflection optimizer. This new feature provides VERY fast startup times (i.e. BuildSessionFactory()). It also provides improved performance in scnearios where you have a lot of private fields that are mapped in a class.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 04, 2006 2:32 pm 
Regular
Regular

Joined: Tue Feb 07, 2006 4:27 pm
Posts: 69
One major benefit (in my opinion) to generics is the ability to use strongly typed collections for data binding and enables intellisense features on these collections.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 05, 2006 8:36 am 
Newbie

Joined: Mon Jun 26, 2006 12:27 pm
Posts: 16
redtap wrote:
What are the benefits using...

http://www.ayende.com/projects/nhiberna ... erics.aspx

over not using it? and are they massive benefits?

Because I find using it kinda confusing...

Thanks!


At first glance, I also thought that implementation was a little confusing and brought extra complexity that I was not sure was worth it. Not only would I have to adopt those methods, people coming behind me would have to understand why the code is written in an unusual way.

I would highly recommend downloading the latest NHIbernate alpha. That's what I'm using and the generics implementation is very intuitive and has worked very well for me so far. It will allow you to work with generics that way you are used to working with IList collections and NHibernate. Admittedly, I've only used it in a very simple way, but I'm using the alpha to get the generics support.

As others have pointed out, using generics helps with data binding. Since .NET is a strongly typed environment for the most part, it helps to have strongly typed collections. It makes data binding and such easier and eliminates having to cast objects here and there and can prevent errors such as stuffing the wrong type into a collection. It makes your code easier and more obvious to read when your collections reflect the type being used rather than just object. It can also help build some generic methods that have the ability to be used in a type specific way. I've found it very helpful. I think if you try it, you'll like it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 06, 2006 5:28 am 
Newbie

Joined: Mon Jun 26, 2006 3:20 pm
Posts: 15
Thanks for you incite sclough! I'll get the alpha downloaded :)

Cheers!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.