Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 我应该在这些示例上实现IDisposable吗_Vb.net_Entity Framework_Idisposable - Fatal编程技术网

Vb.net 我应该在这些示例上实现IDisposable吗

Vb.net 我应该在这些示例上实现IDisposable吗,vb.net,entity-framework,idisposable,Vb.net,Entity Framework,Idisposable,样本1。(如果我的方法之一使用非托管对象) 公共类记录器 '实现IDisposable每个post.run代码分析只问一个问题,它将告诉您应该实现它的类。 Public Class Logger 'Implements IDisposable <<< is this necessary because of unmanaged object inside the method? Public Sub CreateLogFile(ByVal msg As S

样本1。(如果我的方法之一使用非托管对象)

公共类记录器

'实现IDisposable每个post.run代码分析只问一个问题,它将告诉您应该实现它的类。
Public Class Logger
     'Implements IDisposable <<< is this necessary because of unmanaged object inside the method?

     Public Sub CreateLogFile(ByVal msg As String)
        Try

           If Not String.IsNullOrEmpty(_LogDir) Then
             Try
               Using objWriter As New System.IO.StreamWriter(Format(Now, "MM-dd-yyyy HHmmss") & ".txt", True)
                   objWriter.WriteLine(msg)
                   objWriter.Close()
                End Using
             Catch ex As Exception

             End Try
           End If
        Catch ex As Exception
        End Try
    End Sub

End Class
Public Class frmViewerReport
    'Implements IDisposable <<< is this necessary because of event I added in the winform?

    Public Event DoneAutoPrint()
    Public Event Progress()
    Public Event ProgressDone()
    Public Event ErrorRaised(ByVal msg As String)
End Class
Public Class MyRepository
    'Implements IDisposable <<< is this necessary because of dbcontext?

    Private _ctx As New MyEntities
    Private _User As User
End Class

Public Class MyEntities
    Inherits DbContext
End Class