Cleaning up an Entity

Posts   
 
    
Fishy avatar
Fishy
User
Posts: 392
Joined: 15-Apr-2004
# Posted on: 09-Aug-2005 18:21:12   

How important is it to dispose (actually I could not find a Dispose method on an Entity) and set the reference to nothing?

For example, do I need the NewScore = Nothing in this example?

    Public Shared Function ValidateScore(ByRef score As ScoreEntity, ByVal newScoreValue As String, ByVal specialScores As EntityCollection, ByVal errorMessage As String) As Boolean
        Dim NewScore As New ScoreEntity

        Try ...

        Catch ex As Exception
            Throw
        Finally
            NewScore = Nothing
        End Try

    End Function

Thanks,

Fishy

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 09-Aug-2005 18:48:53   

Dispose is not that important on an entity, as it doesn't hold unmanaged resources. Dispose is required when you have an object which holds unmanaged resources (or allocates them indirectly). With an entity, this isn't the case.

Frans Bouma | Lead developer LLBLGen Pro