Error Handling in SSIS - sql-server

I have created a SSIS package which gets the XML file from a folder and checks with the schema, if the schema fails, the package logs the error and moves the file to a error folder. Currently, I have done all the requirements, and is working fine except the error message i'm getting at the end of the execution.
Validate XML file
The error message which I'm getting
The error message which I'm getting
The package works fine as expected. How can I suppress this error message?
Update #1:
This is my error history
This is my XML Schema validation task properties.

Suggestions
The issue may be caused by the FailPackageOnFailure and FailParentOnFailure properties. Click on the Validate XML Task and in the Properties Tab change these properties values. Alos in the Control Flow Go to the properties and change the MaximumErrorCount value and make it bigger than 1.
Also you can find other helpful informations in this link:
Continue Package Execution After Error In SSIS
Workaround using Script Task
Add 3 Variables to your package:
#[User::XmlPath] Type: String, Description: Store the Xml File Path
#[User:XsdPath] Type: String, Description: Store the Xsd File Path
#[User:IsValidated] Type: Boolean, Description: Store the result of Xml validation
Add a script Task, select XmlPath and User:XsdPath as ReadOnly Variables and IsValidated As ReadWrite Variable
Set the Script Language to Visual Basic
In the Script Editor write the following code (this is the whole script task code)
#Region "Imports"
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Math
Imports System.Text
Imports System.Xml
Imports System.Xml.Schema
Imports Microsoft.SqlServer.Dts.Runtime
#End Region
<Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute()>
<System.CLSCompliantAttribute(False)>
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Function LoadXml(xmlFilePath As String, xsdFilePath As String) As Boolean
Dim settings As New XmlReaderSettings()
settings.Schemas.Add(Nothing, xsdFilePath)
settings.ValidationType = ValidationType.Schema
Dim errorBuilder As New XmlValidationErrorBuilder()
AddHandler settings.ValidationEventHandler, New ValidationEventHandler(AddressOf errorBuilder.ValidationEventHandler)
Dim reader As XmlReader = XmlReader.Create(xmlFilePath, settings)
' Read the document...
Dim errorsText As String = errorBuilder.GetErrors()
If errorsText IsNot Nothing Then
Return False
Else
Return True
End If
End Function
Public Sub Main()
Dts.Variables("IsValidated").Value = LoadXml(Dts.Variables("XmlPath").Value.ToString, Dts.Variables("XsdPath").Value.ToString)
Dts.TaskResult = ScriptResults.Success
End Sub
End Class
Public Class XmlValidationErrorBuilder
Private _errors As New List(Of ValidationEventArgs)()
Public Sub ValidationEventHandler(ByVal sender As Object, ByVal args As ValidationEventArgs)
If args.Severity = XmlSeverityType.Error Then
_errors.Add(args)
End If
End Sub
Public Function GetErrors() As String
If _errors.Count <> 0 Then
Dim builder As New StringBuilder()
builder.Append("The following ")
builder.Append(_errors.Count.ToString())
builder.AppendLine(" error(s) were found while validating the XML document against the XSD:")
For Each i As ValidationEventArgs In _errors
builder.Append("* ")
builder.AppendLine(i.Message)
Next
Return builder.ToString()
Else
Return Nothing
End If
End Function
End Class
Use Precedence Constraints with expression to manipulate both of Validation success and failure cases
Script Code Reference
VB.NET validating XML file against XSD file and parsing through the xml

Related

SSIS Script Task not working in Visual Studio 2010, Exception has been thrown by the target of an invocation

I am using SSIS Script Task but whenever I am running it the the SSIS package fails and it gives the following error: Exception has been thrown by the target of an invocation.
Is it possible that it is giving this issue because I was using this script in Visual Studio 2008 and I am trying to implement the package in Visual Studio 2010.
here is my code:
enter code here ' Microsoft SQL Server Integration Services Script Task
' Write scripts using Microsoft Visual Basic 2008.
' The ScriptMain is the entry point class of the script.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.IO
<Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits
Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts property. Connections, variables, events,
' and logging features are available as members of the Dts property as shown in the following examples.
'
' To reference a variable, call Dts.Variables("MyCaseSensitiveVariableName").Value
' To post a log entry, call Dts.Log("This is my log text", 999, Nothing)
' To fire an event, call Dts.Events.FireInformation(99, "test", "hit the help message", "", 0, True)
'
' To use the connections collection use something like the following:
' ConnectionManager cm = Dts.Connections.Add("OLEDB")
' cm.ConnectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;"
'
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Help, press F1.
Public Sub Main()
Dim file_stream As New FileStream(CType(ReadVariable("filepath"), String) + "AIR_FEE1.TRN", FileMode.Append)
Using w As New StreamWriter(file_stream, Text.Encoding.UTF8)
w.WriteLine("T|" + CType(ReadVariable("Count"), String))
End Using
Dim FName As String
Dim LFName As String
FName = CType(ReadVariable("filename"), String)
LFName = CType(ReadVariable("logfile"), String)
WriteVariable("StaticLogFileName", LFName)
WriteVariable("StaticFileName", FName)
Dim file_stream1 As New FileStream("StaticFileName", FileMode.Create)
file_stream.Close()
Dts.TaskResult = ScriptResults.Success
End Sub
Private Function ReadVariable(ByVal varName As String) As Object
Dim result As Object
Try
Dim vars As Variables
Dts.VariableDispenser.LockForRead(varName)
Dts.VariableDispenser.GetVariables(vars)
Try
result = vars(varName).Value
Catch ex As Exception
Throw ex
Finally
vars.Unlock()
End Try
Catch ex As Exception
Throw ex
End Try
Return result
End Function
Private Sub WriteVariable(ByVal varName As String, ByVal varValue As Object)
Try
Dim vars As Variables
Dts.VariableDispenser.LockForWrite(varName)
Dts.VariableDispenser.GetVariables(vars)
Try
vars(varName).Value = varValue
Catch ex As Exception
Throw ex
Finally
vars.Unlock()
End Try
Catch ex As Exception
Throw ex
End Try
End Sub
End Class
First of all, "Exception has been thrown by the target of an invocation" is a generic message that is thrown when an error occurred during script task execution, try to debug your code to find a more precise error message.
I think you can write the same script without defining functions to manipulate your variables:
Public Sub Main()
Dim file_stream As New FileStream(Dts.Variables("filepath").Value + "AIR_FEE1.TRN", FileMode.Append)
Using w As New StreamWriter(file_stream, Text.Encoding.UTF8)
w.WriteLine("T|" + Dts.Variables("Count").Value)
End Using
Dim FName As String
Dim LFName As String
FName = Dts.Variables("filename").Value
LFName = Dts.Variables("logfile").Value
Dts.Variables("StaticLogFileName").Value = LFName
Dts.Variables("StaticFileName").Value = FName
Dim file_stream1 As New FileStream("StaticFileName", FileMode.Create)
file_stream.Close()
Dts.TaskResult = ScriptResults.Success
End Sub
Make sure that you have selected your ReadOnly Variables and ReadWrite Variables properly from the Script task properties form.
Helpful links
Using Variables in the Script Task
3 Ways -SSIS Read Write Variables – Script Task C# / VB.net
Unable to fetch "ReadWrite" Variable Value in Script Component of SSIS

Exception with sqlite database "no such table"

First of all I´m developing a database with autosuggest box. I´ve created a database with DB Browser and imported data. I was reading documentation in C# how connect database and retrieve data. The issue is show up an exception error:
enter image description here
I´ve connected the database in properties with content option. I paste the code:
Public NotInheritable Class METARTAF
Inherits Page
Dim dbpath As String = Path.Combine(ApplicationData.Current.LocalFolder.Path, "airportsdb.sqlite3")
Dim conn As SQLite.Net.SQLiteConnection = New SQLite.Net.SQLiteConnection(New WinRT.SQLitePlatformWinRT(), dbpath)
Dim airportinfo As List(Of String) = Nothing
Public Sub New()
' This call is required by the designer.
InitializeComponent()
End Sub
Private Sub AutoSuggestBox_TextChanged(sender As AutoSuggestBox, args As AutoSuggestBoxTextChangedEventArgs)
Dim datairport As New List(Of String)
Dim retrieve = conn.Table(Of flugzeuginfo)().ToList
If args.Reason = AutoSuggestionBoxTextChangeReason.UserInput Then
If sender.Text.Length > 1 Then
For Each item In retrieve
datairport.Add(item.IATA)
datairport.Add(item.ICAO)
datairport.Add(item.Location)
datairport.Add(item.Airport)
datairport.Add(item.Country)
Next
airportinfo = datairport.Where(Function(x) x.StartsWith(sender.Text)).ToList()
sender.ItemsSource = airportinfo
End If
Else
sender.ItemsSource = "No results..."
End If
End Sub
Private Sub AutoSuggestBox_SuggestionChosen(sender As AutoSuggestBox, args As AutoSuggestBoxSuggestionChosenEventArgs)
Dim selectedItem = args.SelectedItem.ToString()
sender.Text = selectedItem
End Sub
Private Sub AutoSuggestBox_QuerySubmitted(sender As AutoSuggestBox, args As AutoSuggestBoxQuerySubmittedEventArgs)
If args.ChosenSuggestion Is Nothing Then
stationidtxt.Text = args.ChosenSuggestion.ToString
End If
End Sub
Anyone could help about this?
Before you query or insert into a table, you should CREATE it. This tells SQLite what columns you have and suggests datatypes (on other rdbms's you get actual data type enforcement but SQLite does not do that). If this is your problem, you will want to spend some time with the SQLite documentation on data types and the ability to hook them into your application.
On the other hand, as you seem to be trying to retrieve data, this suggess one of two things is wrong. Either you care connecting to the wrong db (in which case SQLite will usually helpfully create an empty db for you!) or else you are specifying the wrong table.

Change connection EF at runtime in WPF app

I have a WPF app that I'd like to change the connection string programmatically when the app loads. I use the Database-First approach for EF.
I spent a lot of time implementing various solutions found online including stack overflow and can't seem to get it to work.
The most common way seems to be to modify the Entity partial class. When I do this I get the following error at runtime:
Additional information: The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. This will not work correctly. To fix this problem do not remove the line of code that throws this exception. If you wish to use Database First or Model First, then make sure that the Entity Framework connection string is included in the app.config or web.config of the start-up project. If you are creating your own DbConnection, then make sure that it is an EntityConnection and not some other type of DbConnection, and that you pass it to one of the base DbContext constructors that take a DbConnection. To learn more about Code First, Database First, and Model First see the Entity Framework documentation here: http://go.microsoft.com/fwlink/?LinkId=394715
I got the same error implementing various other ways as well. If someone could please help me implement a way to change the connection string at runtime I'd greatly appreciate it.
My current implementation is taken from this example solution:
Changing Databases at Run-time using Entity Framework
Implementation:
App.config containts the connection string and name
Partial class added with same name as Entity class:
Imports System.Data.Entity
Imports System.Data.EntityClient
Imports System.Data.SqlClient
Partial Public Class MyEntityName
Inherits DbContext
Public Sub New(ByVal connString As String)
MyBase.New(connString)
End Sub
End Class
In my Application.xaml code file I set a global string variable by calling a method that builds the EntityConnectionStringBuilder. This global string variable is then passed into an entity constructor.
Imports System.Reflection
Imports DevExpress.Xpf.Core
Imports System.Data.EntityClient
Class Application
Public Sub New()
entityConnStr = BuildConnectionString("[MyDataSource]", "[MyDatabase]")
End Sub
Private Function BuildConnectionString(ByVal DataSource As String, ByVal Database As String) As String
' Build the connection string from the provided datasource and database
Dim connString As String = "data source=" & DataSource & ";initial catalog=" & Database & ";persist security info=True;user id=[user];password=[password];trustservercertificate=True;MultipleActiveResultSets=True;App=EntityFramework""
' Build the MetaData... feel free to copy/paste it from the connection string in the config file.
Dim esb As New EntityConnectionStringBuilder()
esb.Metadata = "res://*/DB.[MyEntityName].csdl|res://*/DB.[MyEntityName].ssdl|res://*/DB.[MyEntityName].msl"
esb.Provider = "System.Data.SqlClient"
esb.ProviderConnectionString = connString
' Generate the full string and return it
Return esb.ToString()
End Function
Usage:
Using context = New MyEntity("entityConnStr")
Public connection variable string:
Public entityConnStr As String
I think you should remove the quotes when you pass the connection string to the constructor. You want to use the variable contents, not the variable name.
Use this:
Using context = New MyEntity(entityConnStr)
Instead of this:
Using context = New MyEntity("entityConnStr")

SSIS package on server cannot export to Excel

I have create a SSIS package which works perfectly from my BIDS. But when executing from the server it fails.
The package does the following:
Insert data (read from the SQL database) into an Excel file
Via a VB-script it opens the Excel file and removes line number 2
I can see that the package can insert the data correct in the Excel file. It fails when executing the VB-Script in a step called "Remove 2nd line":
Remove 2ndline: Error: Exception has been thrown by the target of an invocation.
The script is:
#Region "Help: Introduction to the script task"
'The Script Task allows you to perform virtually any operation that can be accomplished in
'a .Net application within the context of an Integration Services control flow.
'Expand the other regions which have "Help" prefixes for examples of specific ways to use
'Integration Services features within this script task.
#End Region
Option Strict Off
#Region "Imports"
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.Office.Interop.Excel
#End Region
'ScriptMain is the entry point class of the script. Do not change the name, attributes,
'or parent of this class.
<Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute()> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Private _app As Microsoft.Office.Interop.Excel.Application
Private _books As Microsoft.Office.Interop.Excel.Workbooks
Private _book As Microsoft.Office.Interop.Excel.Workbook
Protected _sheets As Microsoft.Office.Interop.Excel.Sheets
Protected _sheet1 As Microsoft.Office.Interop.Excel.Worksheet
#Region "Help: Using Integration Services variables and parameters in a script"
'To use a variable in this script, first ensure that the variable has been added to
'either the list contained in the ReadOnlyVariables property or the list contained in
'the ReadWriteVariables property of this script task, according to whether or not your
'code needs to write to the variable. To add the variable, save this script, close this instance of
'Visual Studio, and update the ReadOnlyVariables and
'ReadWriteVariables properties in the Script Transformation Editor window.
'To use a parameter in this script, follow the same steps. Parameters are always read-only.
'Example of reading from a variable:
' startTime = Dts.Variables("System::StartTime").Value
'Example of writing to a variable:
' Dts.Variables("User::myStringVariable").Value = "new value"
'Example of reading from a package parameter:
' batchId = Dts.Variables("$Package::batchId").Value
'Example of reading from a project parameter:
' batchId = Dts.Variables("$Project::batchId").Value
'Example of reading from a sensitive project parameter:
' batchId = Dts.Variables("$Project::batchId").GetSensitiveValue()
#End Region
#Region "Help: Firing Integration Services events from a script"
'This script task can fire events for logging purposes.
'Example of firing an error event:
' Dts.Events.FireError(18, "Process Values", "Bad value", "", 0)
'Example of firing an information event:
' Dts.Events.FireInformation(3, "Process Values", "Processing has started", "", 0, fireAgain)
'Example of firing a warning event:
' Dts.Events.FireWarning(14, "Process Values", "No values received for input", "", 0)
#End Region
#Region "Help: Using Integration Services connection managers in a script"
'Some types of connection managers can be used in this script task. See the topic
'"Working with Connection Managers Programatically" for details.
'Example of using an ADO.Net connection manager:
' Dim rawConnection As Object = Dts.Connections("Sales DB").AcquireConnection(Dts.Transaction)
' Dim myADONETConnection As SqlConnection = CType(rawConnection, SqlConnection)
' <Use the connection in some code here, then release the connection>
' Dts.Connections("Sales DB").ReleaseConnection(rawConnection)
'Example of using a File connection manager
' Dim rawConnection As Object = Dts.Connections("Prices.zip").AcquireConnection(Dts.Transaction)
' Dim filePath As String = CType(rawConnection, String)
' <Use the connection in some code here, then release the connection>
' Dts.Connections("Prices.zip").ReleaseConnection(rawConnection)
#End Region
'This method is called when this script task executes in the control flow.
'Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'To open Help, press F1.
Public Sub Main()
Try
Dim FileName As String = ""
If Dts.Variables.Contains("DestinationPath") = True Then
FileName = CType(Dts.Variables("DestinationPath").Value, String)
End If
OpenExcelWorkbook(FileName)
_sheet1 = CType(_sheets(1), Microsoft.Office.Interop.Excel.Worksheet)
_sheet1.Activate()
Dim range As Microsoft.Office.Interop.Excel.Range = _sheet1.Rows(2)
range.Delete(Microsoft.Office.Interop.Excel.XlDeleteShiftDirection.xlShiftUp)
DoRelease(range)
DoRelease(_sheet1)
CloseExcelWorkbook()
DoRelease(_book)
_app.Quit()
DoRelease(_app)
Dts.TaskResult = ScriptResults.Success
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Protected Sub OpenExcelWorkbook(ByVal fileName As String)
'try
'{
_app = New Microsoft.Office.Interop.Excel.Application()
If _book Is Nothing Then
_books = _app.Workbooks
_book = _books.Open(fileName, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing)
_sheets = _book.Worksheets
End If
'}
'catch(Exception ex)
'{
' Console.WriteLine(ex.ToString());
'}
End Sub
Protected Sub CloseExcelWorkbook()
_book.Save()
_book.Close(False, Type.Missing, Type.Missing)
End Sub
Protected Sub DoRelease(ByVal o As Object)
Try
If Not o Is Nothing Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(o)
End If
Finally
o = Nothing
End Try
End Sub
#Region "ScriptResults declaration"
'This enum provides a convenient shorthand within the scope of this class for setting the
'result of the script.
'This code was generated automatically.
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
#End Region
End Class
The Excel file is reached by the variable "DestinationPath". This path works when outside the script (ie it can fill data in the file in a previous step). It also works when in BIDS in the script. I have also made sure to make it available to the script as a ReadOnlyVariable. So I am pretty confident that it is not a problem with the variable.
My server is a Windows 2012 R2 (64-bit)
The package is being executed on an SQL Server 2012 - 11.0.
I have installed Excel 2013 on the server.
I have created the following folder as this could also cause the problem (I have read): C:\Windows\SysWOW64\config\systemprofile\Desktop
The caller of my script is my administrator userid - and this userid is capable of using Excel on the server.
Is there any reason we couldn't use the regular Excel Connection manager to insert data, and instead of deleting line 2, just never send it? Use a Conditional Split to siphon it off. Here is a simple example. Here is an advanced example of using SSIS default Excel Connection manager. I'd also like to grant a pearl of wisdom against using Interop.Excel inside of script tasks. It can certainly lead to these types of "But, it works on my Machine" scenarios. Read KB257757 to see why Microsoft discourages this type of thing. However, some things only Interop.Excel can do, such as saving to PDF or running macros. You're not doing either of those things, so why not give the regular Excel connector a try?

How to dynamically pass connectionstrings in EF5

I'm struggling with a project, converted to .net 4.5.
I have some functions like this:
Public Shared Function Load(iJaar As Integer, iKwartaal As Integer) As List(Of LoonDetail_121)
Dim oLoonDetails As New List(Of LoonDetail_121)
Try
Dim oDB As New SDWMasterSDWDBEntities(DBConnections.ConnStringPrisma)
Dim dStartDate As New Date(iJaar, ((iKwartaal - 1) * 3) + 1, 1)
Dim dEndDate As New Date(iJaar, ((iKwartaal - 1) * 3) + 4, 1)
oLoonDetails = oDB.LoonDetail_121.Where(Function(x) x.EindPeriode_121 >= dStartDate And
x.EindPeriode_121 < dEndDate).ToList
Catch ex As Exception
Throw New Exception(GetCurrentMethod.Name & " " & ex.Message)
End Try
Return oLoonDetails
End Function
When I convert this function to EF5, I get errors, since my SDCDBLonenEntities is not inherited anymore from ObjectContext, but it is inherited from DbContext.
Before, EF automatically created a constructor where I can pass my Connection String.
This is very easy, because I use different connectionstrings, depending on my Solution Configuration (Debug/Release).
In EF5, the constructor doesn't accept Connectionstrings anymore.
I tried to create a partial class of my Entity, and create my own constructor, but I can't get this working:
Partial Public Class SDWMasterSDWDBEntities
Inherits DbContext
Public Sub New(sConnString As String)
MyBase.New(sConnString)
End Sub
End Class
For another project, I adapted my Project-file to use different app.config files for each solution configuration, but that was a p.i.t.a to maintain and for me not a clean solution.
So my question is: How can I use EF5 with my own personal Connectionstrings?
These are my Connection Strings by the way:
#If DEBUG Then
Friend ConnStringSDW As String = "metadata=res://*/Entities.SDWDB.csdl|res://*/Entities.SDWDB.ssdl|res://*/Entities.SDWDB.msl;provider=System.Data.SqlClient;provider connection string='data source=SDWDB01\SDWSQL;initial catalog=SDWDB_DEV;persist security info=True;user id=usr;password=pwd;multipleactiveresultsets=True;App=EntityFramework'"
#Else
Friend ConnStringSDW As String = "metadata=res://*/Entities.SDWDB.csdl|res://*/Entities.SDWDB.ssdl|res://*/Entities.SDWDB.msl;provider=System.Data.SqlClient;provider connection string='data source=SDWDB01\SDWSQL;initial catalog=SDWDB_PROD;persist security info=True;user id=usr;password=pwd;multipleactiveresultsets=True;App=EntityFramework'"
#End If
And I get the error "The entity type SDW_USERS_MASTER is not part of the model for the current context.", when I execute this function:
Public Shared Function LoadAll() As List(Of SDW_USERS_MASTER)
Dim oUsers As New List(Of SDW_USERS_MASTER)
Try
Using oDB As New SDWMaster.SDWMasterSDWDBEntities(DBConnections.ConnStringSDW)
oUsers = (From tmpUsers In oDB.SDW_USERS_MASTER
Select tmpUsers).ToList.OrderBy(Function(x) x.Login).ToList
End Using
Catch ex As Exception
Debug.Print(ex.Message)
Throw New Exception(GetCurrentMethod.Name & " " & ex.Message)
End Try
Return oUsers
End Function
Create a new partial class with the same name as your context, then overload the constructor. So, if your context class is named "myContext", then you would have:
Imports System
Imports System.Data.Entity
Imports System.Data.Entity.Infrastructure
Imports System.Data.Objects
Imports System.Data.Objects.DataClasses
Imports System.Linq
Partial Public Class myContext
Inherits DbContext
Public Sub New(connectionString As String)
MyBase.New(connectionString)
End Sub
End Class

Resources