I have proyect that use linq to postgresql, I have the library and Its three dependencies.
But when I try to connect to de DB I get this error:
First chance of Exception of type ' System.NullReferenceException
' in linq2db.dll
. Additional information: Object reference not set to an instance of an object. (Translated).
Stack trace:
in LinqToDB.Data.DataConnection..ctor(String configurationString) in i:\linq2db\Source\Data\DataConnection.cs:line 41 in LinqToDB.Data.DataConnection..ctor() in i:\linq2db\Source\Data\DataConnection.cs:line 24 in modelo.BDGestion.bdgestionDB..ctor() in d:\Proyectos\Proyectos VisualStudio\TimeSheets\TimeSheets\modelo\BDGestion.PostgreSQL.generated.cs:línea 44 en TimeSheets.SeleccionPersonal..ctor() in d:\Proyectos\Proyectos VisualStudio\TimeSheets\TimeSheets\SeleccionPersonal.cs:line 23
public partial class SeleccionPersonal : Form
{
public SeleccionPersonal()
{
InitializeComponent();
try
{
using (var db = new bdgestionDB())
{
}
}catch(Exception ex){
MessageBox.Show(ex.ToString());
}
}
}
I generated the classes using the template, the connection String is well formed and properly added to de connectionStrings. Checked it by me in this solution and by a friend in other computer by its own. If you need any information just ask.
Generated class:
public partial class bdgestionDB : LinqToDB.Data.DataConnection
{
tables...
public bdgestionDB()
{
InitDataContext();
}
public bdgestionDB(string configuration)
: base(configuration)
{
InitDataContext();
}
partial void InitDataContext();
}
The App.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="Postgres" connectionString="Server=thot-test;Port=5432;Database=bdgestion;UserId=test;Password=T15Pmc;Pooling=true;MinPoolSize=10;MaxPoolSize=100;Protocol=3;"/>
</connectionStrings>
</configuration>