Page 1 of 1

UniConnection ProviderFactory null

Posted: Thu 05 May 2016 12:54
by giuliano
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

Re: UniConnection ProviderFactory null

Posted: Thu 05 May 2016 13:45
by Shalex
dotConnect Universal doesn't support Entity Framework. You should use Professional Edition of database specific provider, e.g. dotConnect for PostgreSQL Professional.

Re: UniConnection ProviderFactory null

Posted: Thu 05 May 2016 17:27
by giuliano
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

Re: UniConnection ProviderFactory null

Posted: Fri 06 May 2016 08:55
by Shalex
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);

Re: UniConnection ProviderFactory null

Posted: Fri 06 May 2016 11:01
by giuliano
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

Re: UniConnection ProviderFactory null

Posted: Tue 10 May 2016 11:10
by Shalex
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.

Re: UniConnection ProviderFactory null

Posted: Tue 10 May 2016 18:43
by giuliano
Thanks,
Giuliano Medina

Re: UniConnection ProviderFactory null

Posted: Fri 27 May 2016 17:32
by Shalex
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.