UniConnection ProviderFactory null

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for universal data access
Post Reply
giuliano
Posts: 24
Joined: Mon 18 Oct 2010 12:59

UniConnection ProviderFactory null

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Post by 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.

giuliano
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Post by 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);

giuliano
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Post by 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

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Post by 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.

giuliano
Posts: 24
Joined: Mon 18 Oct 2010 12:59

Re: UniConnection ProviderFactory null

Post by giuliano » Tue 10 May 2016 18:43

Thanks,
Giuliano Medina

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: UniConnection ProviderFactory null

Post by 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: viewtopic.php?f=4&t=33720.

Post Reply