Imports System.IO
Imports System.Reflection
Imports C1.Data.Entities

Public Class Program
    Public Shared ClientCache As EntityClientCache

    <STAThread()> _
    Shared Sub Main()

        AppDomain.CurrentDomain.SetData("DataDirectory", Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\ComponentOne Samples\Common")
        ' Specify where should Entity Framework look for the Northwind database.
        Dim dbFile As String = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\ComponentOne Samples\Common", "Northwnd.mdf")
        If Not File.Exists(dbFile) Then
            Throw New Exception("Sample database Northwnd.mdf must be created in the Common folder. Run the CreateSampleDB utility to create the Northwind database")
        End If

        ' Get a global ClientCache and save it in a static field
        ' so it is accessible from any class of the project.
        ClientCache = EntityClientCache.GetDefault(GetType(NORTHWNDEntities))

        Application.EnableVisualStyles()
        Application.SetCompatibleTextRenderingDefault(False)
        Application.Run(New MainForm())
    End Sub
End Class
