NHibernate 2.1 released

NHibernate 2.1 is out, and it has all kinds of good stuff™.
  • You don't need parameterless constructors on your entities anymore! No more of this mess:
            ''' <summary>
            ''' NHibernate-only. Do not use.
            ''' </summary>
            ''' <remarks></remarks>
            Public Sub New()
            End Sub
    
            ''' <summary>
            ''' Real constructor
            ''' </summary>
            ''' <remarks></remarks>
            Public Sub New(param1 As String, param2 As Date)
            End Sub
  • Dependency injection for entities. Now, just inject your services right in to the constructor of the entity, instead of having to go get them every time you call your entity's methods.
    This:
    Public Sub New()
    End Sub
    
    Public Function ChangePassword(oldPassword As String, newPassword As String, passwordHasher As IPasswordHashService) As String
         ' Do stuff
    End Function
    
    becomes:
    Public Sub New(passwordHasher As IPasswordHashService)
         m_PasswordHasher = passwordHasher
    End Sub
    
    Public Function ChangePassword(oldPassword As String, newPassword As String) As String
         'Do Stuff
    End Function
    
    The benefit is that you don't have to inject your IPasswordHashService in to everything that calls ChangePassword.
  • Finally, support for HashSet(Of T) instead of that weird little IESI implementation. Since .NET doesn't come with an ISet(Of T) interface, use ICollection(Of T).
  • Works with new SQL 2008 data types: Date, Time, and DateTimeOffset.
- Jason Hibernating
blog comments powered by Disqus