dotConnect for QuickBooks: Keyword not supported: 'company id'

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
danielrail
Posts: 11
Joined: Tue 10 Feb 2015 18:22

dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by danielrail » Mon 27 Mar 2017 18:11

Hi,

I'm trying the dotConnect for QuickBooks version 1.6.378.0 (trial version).

This is the error that I'm getting:
System.ArgumentException was unhandled by user code
HResult=-2147024809
Message=Keyword not supported: 'company id'.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions.ParseInternal(IDictionary`2 parsetable, String connectionString, IList`1 validKeywords)
at System.Data.Entity.Core.EntityClient.Internal.DbConnectionOptions..ctor(String connectionString, IList`1 validKeywords)
at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.Entity.Core.EntityClient.EntityConnection..ctor(String connectionString)
at System.Data.Entity.Core.Objects.ObjectContext.CreateEntityConnection(String connectionString)
at System.Data.Entity.Core.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at QuickBooksModel.QuickBooksEntities..ctor(String connectionString) in E:\Projects\Filopto\Version 10 Official\QuickBooks Connector\QuickBooksConnectorModule\FiloptoQB_Business_Logic_Library\QuickBooksDataModel.Designer.cs:line 96
at FiloptoQB_Business_Logic_Library.QBOPaymentAccountsViewModel.LoadData(String pDBServer, String pDBName) in E:\Projects\Filopto\Version 10 Official\QuickBooks Connector\QuickBooksConnectorModule\FiloptoQB_Business_Logic_Library\QBOPaymentAccountsViewModel.cs:line 60
at QuickBooksConnectorModule.QuickBooksMainScreen.SetupDatabaseConnection(String pDatabaseServer, String pDatabasename) in E:\Projects\Filopto\Version 10 Official\QuickBooks Connector\QuickBooksConnectorModule\QuickBooksConnectorModule\QuickBooksMainScreen.xaml.cs:line 157
at QuickBooksConnectorModule.QuickBooksPlugin.DisplayForm(Int32 Top, Int32 Left) in E:\Projects\Filopto\Version 10 Official\QuickBooks Connector\QuickBooksConnectorModule\QuickBooksConnectorModule\QuickBooksPlugin.cs:line 46
InnerException:
An example of the connection string that I'm passing looks like this:
"Company Id=XXXX;Access Token=YYYY;Access Token Secret=YYYYsecret;Consumer Key=ZZZZ;Consumer Secret=ZZZZsecret;Sandbox=True"

I replaced the real values, to hide them. I'm using the QuickBooksConnectionStringBuilder to construct the connection string to pass to QuickBooksEntities.

Also, I added the Entity Framework 6 to the project using NuGet.

Any help would be appreciated.

Daniel Rail

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

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by Shalex » Mon 27 Mar 2017 19:22

danielrail wrote:Keyword not supported: 'company id'.
Refer to viewtopic.php?f=1&t=26203 (just replace "Oracle" entries with "QuickBooks").

JIC:
1. We recommend you to use Entity Developer (the Devart Entity Model item, *.edml) instead of EDM Designer (the ADO.NET Entity Data Model item, *.edmx) because it is adjusted for working with QuickBooks and has an advanced functionality: http://www.devart.com/entitydeveloper/ed-vs-edm.html.
2. If you decide to try the DbContext template (via Tools > Entity Developer > Model Explorer > the Templates node), there is a good article: http://blog.devart.com/entity-developer ... plate.html.

danielrail
Posts: 11
Joined: Tue 10 Feb 2015 18:22

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by danielrail » Tue 28 Mar 2017 17:29

Hi,

I am using the Devart Entity Developer(with the .edml).

The current template that it is using is the EntityObject template. Are you suggesting that I should use the DbContext template, instead?

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

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by Shalex » Tue 28 Mar 2017 17:54

danielrail wrote:Are you suggesting that I should use the DbContext template, instead?
No, I'm not. You should use a template which better suits your task: http://www.c-sharpcorner.com/UploadFile ... dbcontext/.

danielrail
Posts: 11
Joined: Tue 10 Feb 2015 18:22

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by danielrail » Tue 28 Mar 2017 18:37

Hi,

When looking at the Oracle thread, I noticed one thing that I was missing. And, it was to also use the EntityConnectionStringBuilder. Using that resulting string, gave me another error. That error is that the entity framework provider "Devart.Data.QuickBooks" is not registered with the application. I do recognize what this error means, since I did encounter it when I configured Firebird's EF6 ADO.Net driver. Because the main application is a Delphi application(and not .Net), the .config file is not referenced. I was able to register Firebird's EF6 ADO.Net driver with the following code:

Code: Select all

    public class FBConfiguration:DbConfiguration
    {
        public FBConfiguration()
        {
            SetProviderServices(FirebirdSql.Data.EntityFramework6.FbProviderServices.ProviderInvariantName, FirebirdSql.Data.EntityFramework6.FbProviderServices.Instance);
            SetProviderFactory(FirebirdSql.Data.EntityFramework6.FbProviderServices.ProviderInvariantName, FirebirdSql.Data.FirebirdClient.FirebirdClientFactory.Instance);
        }
    }

    [DbConfigurationType(typeof(FBConfiguration))]
    public partial class FiloptoDBModel
    {
        public FiloptoDBModel(string NameOrConnectionString) : base(NameOrConnectionString)
        {
        }

        public FiloptoDBModel(DbConnection existingConnection, bool contextOwnsConnection): base(existingConnection, contextOwnsConnection)
        {
        }
    }
How can I do something similar with the dotConnect for QuickBooks?
Or, is there another way to register the provider, in runtime?

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

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by Shalex » Fri 31 Mar 2017 14:59

When your code uses dotConnect for QuickBooks via a factory-based class, you should register configuration information in the DbProviderFactories section of the *.config file to inform your environment about the existence of the provider factory:

Code: Select all

<system.data>
  <DbProviderFactories>
    <remove invariant="Devart.Data.QuickBooks" />
    <add name="dotConnect for QuickBooks" invariant="Devart.Data.QuickBooks" description="Devart dotConnect for QuickBooks" type="Devart.Data.QuickBooks.QuickBooksProviderFactory, Devart.Data.QuickBooks, Version=1.6.378.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  </DbProviderFactories>
</system.data>
Replace 1.6.378.0 here with your actual version.

JIC: there is a way to register provider in DbProviderFactories via code (instead of *.config) like described at viewtopic.php?f=29&t=28550.

danielrail
Posts: 11
Joined: Tue 10 Feb 2015 18:22

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by danielrail » Fri 31 Mar 2017 18:36

Thanks for the reply. But, I still can't get it to work.

Here are the things that I tried.

I tried this code:

Code: Select all

   public class QBOConfiguration: DbConfiguration
    {
        public QBOConfiguration()
        {
            SetProviderServices("Devart.Data.QuickBooks", Devart.Data.QuickBooks.Entity.QuickBooksEntityProviderServices.Instance);
            SetProviderFactory("Devart.Data.QuickBooks", Devart.Data.QuickBooks.QuickBooksProviderFactory.Instance);
        }
    }

    [DbConfigurationType(typeof(QBOConfiguration))]
    public partial class QuickBooksEntities
    {
        public QuickBooksEntities(string NameOrConnectionString, bool pQBO) : base(NameOrConnectionString)
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    }
But, it still gives the following error:
QuickBooksDataModel.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'Devart.Data.QuickBooks'. Make sure the provider is registered in the 'entityFramework' section of the application config file.
Then, I tried to see if I would be able add "Devart.Data.QuickBooks" to the entityFramework section, by using the following code:

Code: Select all

            bool DevartProviderRegistered = false;
            var dataSet = System.Configuration.ConfigurationManager.GetSection("entityFramework") as DataSet;
            foreach (DataRow dr in dataSet.Tables[0].Rows)
            {
                if ((string)dr[2] == "Devart.Data.QuickBooks")
                {
                    DevartProviderRegistered = true;
                }
            }

            if (!DevartProviderRegistered)
            {
                dataSet.Tables[0].Rows.Add("dotConnect for QuickBooks"
                  , "Devart dotConnect for QuickBooks"
                  , "Devart.Data.QuickBooks"
                  ,
                  "Devart.Data.QuickBooks.Entity.QuickBooksEntityProviderServices, Devart.Data.QuickBooks.Entity.EF6");
            }     
But, that didn't work either, because the returned dataset is null. And, if I try with the section "system.data", it does recognize that Devart.Data.QuickBooks is already there.

I saw in the example that you gave for SQLite, to change the constructor to call the DbConfiguration.SetConfiguration(new SQLiteConfiguration()) within the DbContext constructor.

But, the problem that I'm seeing is that all of the constructors that were create for the QuickBooks model that I'm using all call a base constructor, for which I'm not seeing any code for, and the exception gets triggered in that base constructor, before any code within those defined is executed.

Just as a reference point, here's the code that Entity Developer created for the QuickBooks model that I'm using:

Code: Select all

public partial class QuickBooksEntities : ObjectContext
    {
        #region Constructors
        /// <summary>
        /// Initialize a new QuickBooksEntities object.
        /// </summary>
        public QuickBooksEntities() : 
                base(@"name=QBEntitiesConnectionString", "QuickBooksEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }

        /// <summary>
        /// Initializes a new QuickBooksEntities object using the connection string found in the 'QuickBooksEntities' section of the application configuration file.
        /// </summary>
        public QuickBooksEntities(string connectionString) : 
                base(connectionString, "QuickBooksEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new QuickBooksEntities object.
        /// </summary>
        public QuickBooksEntities(EntityConnection connection) : base(connection, "QuickBooksEntities")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }

        #endregion
Any ideas how I can get this to work?

This is a trial version dotConnect for QuickBooks that I'm using, but I have to make certain that it will work, before purchase.

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

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by Shalex » Wed 05 Apr 2017 15:37

Please create a new console application and follow these steps:

1. Add this entry to your *.config:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <providers>
      <provider invariantName="Devart.Data.QuickBooks" type="Devart.Data.QuickBooks.Entity.QuickBooksEntityProviderServices, Devart.Data.QuickBooks.Entity.EF6" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="Devart.Data.QuickBooks" />
      <add name="dotConnect for QuickBooks" invariant="Devart.Data.QuickBooks" description="Devart dotConnect for QuickBooks" type="Devart.Data.QuickBooks.QuickBooksProviderFactory, Devart.Data.QuickBooks" />
    </DbProviderFactories>
  </system.data>
</configuration>
2. Add references to the following Devart.* assemblies:
* Devart.Data.dll
* Devart.Data.QuickBooks.dll
* Devart.Data.SqlShim.dll
* Devart.Data.QuickBooks.Entity.EF6.dll

3. Run the command via Tools > NuGet Package Manager > Package Manager Console:
install-package entityframework

4. Save the project and rebuild (!) it.

5. Right click project in Solution Explorer > Add > New Item > Data > Devart Entity Model (or ADO.NET Entity Data Model) and follow the wizard steps.


Does it work now? If not:

a) specify the exact text of the current error and its stack trace

b) did you install dotConnect for QuickBooks Professional Trial with the "Do not install assemblies in the GAC" option turned on or turned off?

c) send us a test project for reproducing the error

Notify us about the result.

danielrail
Posts: 11
Joined: Tue 10 Feb 2015 18:22

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by danielrail » Mon 10 Apr 2017 14:29

Thank you for the response.

Our first plan was to develop a .Net plugin for a Win32 Delphi application. But, with the problems that we encountered, we simply decided on a second plan, which was that our Win32 Delphi application simply called a .Net executable, for the QuickBooks connectivity. And, the trial version of dotConnect for QuickBooks worked very well, in a stand-alone application, so we did make the purchase.

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

Re: dotConnect for QuickBooks: Keyword not supported: 'company id'

Post by Shalex » Tue 11 Apr 2017 08:16

Thank you for letting us know.

Post Reply