UniConnection ProviderFactory null

UniConnection ProviderFactory null

Postby giuliano » Thu 05 May 2016 12:54

Hello,

I'm trying to create a new instance of the class UniConnection and get it's "ProviderFactory" property with "System.Data.Entity.Core.Common.DbProviderServices.GetProviderFactory()" but the UniConnection is being created with the property "ProviderFactory" as null value.

My code is :
Code: Select all
var m_Connection = new UniConnection(MyDevartConnectionString);
var m_Provider = DbProviderServices.GetProviderFactory(m_Connection);


I get the following exception:
Code: Select all
"An unhandled exception of type 'System.Data.Entity.Core.ProviderIncompatibleException' occurred in EntityFramework.dll

Additional information: A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type 'Devart.Data.Universal.UniConnection'. The store provider might not be functioning correctly."


I can't set it's value because it's private. How can I proceed ?

Thanks,
Giuliano Medina
giuliano
 
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Postby Shalex » Thu 05 May 2016 13:45

dotConnect Universal doesn't support Entity Framework. You should use Professional Edition of database specific provider, e.g. dotConnect for PostgreSQL Professional.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Postby giuliano » Thu 05 May 2016 17:27

Ok. I know Devart dotConnect Universal doesn't support Entity Framework, but my questions is:
Why when I create a UniConnection, the field "ProviderFactory" is setted to null ? It should have the value of the provider (Devart in this case).

Thanks,
Giuliano Medina
giuliano
 
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Postby Shalex » Fri 06 May 2016 08:55

Please use
Code: Select all
var m_Provider = System.Data.Common.DbProviderFactories.GetFactory("Devart.Data.Universal");

instead of
Code: Select all
var m_Provider = System.Data.Entity.Core.Common.DbProviderServices.GetProviderFactory(m_Connection);
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Postby giuliano » Fri 06 May 2016 11:01

I need to get the factory of a UniConnection, and not from a string.

In my scenario, I have no choice but to use Entity's method, so i'll repeat my question:
"Why when I create a UniConnection, the field "ProviderFactory" is setted to null ? It should have the value of the provider (Devart in this case)."

I used your method ("System.Data.Common.DbProviderFactories.GetFactory()") passing a UniConnection, and it also returns null.

The reason the Entity's method doesn't work, is the same reason yours method doesn't work, because the UniConnection's field "ProviderFactory" is setted to null.

I used another Provider connection for test, and when I created it, there was the value of the Provider in the DBConnection field ProviderFactory, so both methods worked.

Do you know how to set this field ?

Thanks,
Giuliano Medina
giuliano
 
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Postby Shalex » Tue 10 May 2016 11:10

giuliano wrote:The reason the Entity's method doesn't work, is the same reason yours method doesn't work, because the UniConnection's field "ProviderFactory" is setted to null.
We will notify you when the issue is fixed.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Postby giuliano » Tue 10 May 2016 18:43

Thanks,
Giuliano Medina
giuliano
 
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Postby Shalex » Fri 27 May 2016 17:32

The bug with using the System.Data.Common.DbProviderFactories.GetFactory(DbConnection) method with the UniConnection object is fixed in the newest (3.60.1155) build: http://forums.devart.com/viewtopic.php?f=4&t=33720.
Shalex
Devart Team
 
Posts: 7654
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect Universal