llblgen ver.5.3 with firebird 2.5 embedded

Posts   
 
    
alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 27-Nov-2017 22:36:53   

Is that necessary to install firebird as service through Firebird-2.5.7.27050_0_Win32.exe or FirebirdSql.Data.FirebirdClient-5.12.0.0.msi for llblgen to connect to the embedded firebird? I have figured out that if there is two "FirebirdClient Data Provider"(FirebirdClient ver.5.11 and 5.12) in the machine.config , the llblgen will throw the exception from generated source code.

  • What the dependencies that the llblgen should have to run with firebird embedded ?
  • For the deployment,is that necessary to run FirebirdSql.Data.FirebirdClient-5.12.0.0.msi or manually modify machine.config if firebird client provider is archive version?
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Nov-2017 09:28:25   

alonsoChen wrote:

Is that necessary to install firebird as service through Firebird-2.5.7.27050_0_Win32.exe or FirebirdSql.Data.FirebirdClient-5.12.0.0.msi for llblgen to connect to the embedded firebird?

Only Firebird official client is needed

alonsoChen wrote:

I have figured out that if there is two "FirebirdClient Data Provider"(FirebirdClient ver.5.11 and 5.12) in the machine.config , the llblgen will throw the exception from generated source code.

  • What is the exception (message and stacktrace)?
  • What is your LLBLGen build version?

alonsoChen wrote:

What the dependencies that the llblgen should have to run with firebird embedded ?

Only Firebird official client is needed. Just make sure that the connection string is adapted to embedded.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 28-Nov-2017 09:29:21   

You should only have 1 provider registered under an invariant name in the machine.config. It will always give an exception if there are two or more for Firebird client. So remove the one that's not used (e.g. the older one, as you installed 2).

For firebird embedded, if I recall correctly, you have to store the embedded dll in the application's executable folder. Additionally, it has to know about the Firebird client dll, as our runtime works with DbProviderFactories.

There are two ways a factory of an ADO.NET provider (such as the Firebird client) is registered in the DbProviderFactories: through machine.config or through the application's app/web.config file. If you don't want to run an installer on the machine where you're deploying, you can copy the firebird client dll into the app's executable folder and register the factory in the app's web/app.config file. For an example of how to do that, see the LLBLGenPro.exe.config file which has a section (commented out) for that. I've copied it below

part of your app's app/web.config file


    <system.data>
        <DbProviderFactories>
            <add name="Firebird Client Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=5.3.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/>
        </DbProviderFactories>
    </system.data>

Frans Bouma | Lead developer LLBLGen Pro
alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 28-Nov-2017 22:38:37   

For the worst case,if there are three factory providers,two in machine.config and one in app/web.config,what should I to deal with the situation? It's can be possible for the customer's environment that there are two provides in the machine.config .

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 28-Nov-2017 23:56:24   

Then deploy the dll with your application (in the same folder) and have the configuration set in the app.config or web.config, this should override whatever is in the machine.config

alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 29-Nov-2017 09:34:41   

Walaa wrote:

Then deploy the dll with your application (in the same folder) and have the configuration set in the app.config or web.config, this should override whatever is in the machine.config

there is the exception after put the facotry provider in app.config

An exception of type 'System.TypeInitializationException' occurred in invoiceFirebirdDBSpecific.dll but was not handled in user code

Additional information: The type initializer for 'SD.LLBLGen.Pro.DQE.Firebird.DynamicQueryEngine' threw an exception.

throw from call "return this.PostProcessNewDynamicQueryEngine(new DynamicQueryEngine());"

here is my app.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
        <section name="webApi.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
    <userSettings>
        <webApi.Properties.Settings>
            <setting name="businessid" serializeAs="String">
                <value />
            </setting>
            <setting name="branchno" serializeAs="String">
                <value />
            </setting>
            <setting name="posno" serializeAs="String">
                <value />
            </setting>
            <setting name="serverSelected" serializeAs="String">
                <value />
            </setting>
        </webApi.Properties.Settings>
    </userSettings>
  <system.data>
    <DbProviderFactories>
      <add name="Firebird Client Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".Net Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=5.12.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"/>
    </DbProviderFactories>
  </system.data>
</configuration>

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 29-Nov-2017 10:07:56   

it can't initialize the factory instance I think. Is there more in the exception than just that? Where is the dll located? Is it copy/pasted from somewhere into the application's bin folder? Is there a stacktrace?

Does the machine.config file also define a factory? If so, can you remove those for testing and see what changes?

Frans Bouma | Lead developer LLBLGen Pro
alonsoChen
User
Posts: 30
Joined: 27-Nov-2017
# Posted on: 29-Nov-2017 10:13:37   

Otis wrote:

it can't initialize the factory instance I think. Is there more in the exception than just that? Where is the dll located? Is it copy/pasted from somewhere into the application's bin folder? Is there a stacktrace?

Does the machine.config file also define a factory? If so, can you remove those for testing and see what changes?

remove the factory provider in machine.config and let it only in app.config is fine. Tks!wink

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 29-Nov-2017 10:41:06   

Ok. To recap:

2 lines in machine.config for the same invariant name isn't good: 1 line per invariant name is maximum, so if you have two for an invariant name (the name after 'invariant', so "FirebirdSql.Data.FirebirdClient"), just remove one, as it's always an error.

The one in app/web.config doesn't 'override' the one in machine.config, it simply will add another line at runtime to the set of factories in DbProviderFactories and will fail when the factory is obtained from it (DbProviderFactories will throw an exception), or will give an error that the definition is already there.

To prevent this, either use a

<clear />

element right below <DbProviderFactories> in your app/web.config file so all definitions from machine.config are removed, or don't define another factory in the app/web.config file but define an assembly redirect from the version in the machine.config file to the dll you're using.

This to avoid editing machine.config file as it's a machine wide file which might affect other applications on your system simple_smile

Frans Bouma | Lead developer LLBLGen Pro