dotConnect for PostgreSQL Documentation
Deployment
[email protected]

To deploy applications written with dotConnect for PostgreSQL you should register run-time assemblies Devart.Data.PostgreSql.dll and Devart.Data.dll at Global Assembly Cache (GAC) for appropriate framework or place them in the folder of your application (Bin folder for web projects). These two assemblies should be available in all applications written with dotConnect for PostgreSQL. Make sure that your project contains the license resource as it is described in Licensing.

Another way to install the needed *.dll is to launch the dotConnect for PostgreSQL setup program and choose "Minimal installation". Note that according to End-User License Agreement this is the only install you can do on target machine. You must not distribute any other part of dotConnect for PostgreSQL.

Applications written with dotConnect for PostgreSQL may not contain the license resource when they are deployed on the target machine where dotConnect for PostgreSQL is installed with "Minimal" option.

When your code uses dotConnect for PostgreSQL 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. The provider factory is described either in machine.config (globally), in app.config or in web.config (just for your application). This is done as follows:

<system.data>
  <DbProviderFactories>
    <remove invariant="Devart.Data.PostgreSql" />
    <add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL" type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version=7.1.26.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
  </DbProviderFactories>
</system.data>

Replace 7.1.26.0 here with your actual version.


Continuous Integration

If you set up a pipeline for compiling your source code from repository on a build server periodically or even after every commit, you should add a step to your pipeline for installing the provider on the build server, copying Devart assemblies, registering provider build action, and enabling automatic generation of .NET Framework license resource from provider entry in licenses.licx. For example, the corresponding step in Azure DevOps Pipeline can be the following one if you copied the provider installation to the root folder of your repository:

- task: [email protected]
  inputs:
    script: '$(Build.SourcesDirectory)\dcpostgresql.exe /TYPE=FULL /VERYSILENT'

More information about the command line installation keys can be found here.

ASP.NET Applications

When deploying ASP.NET applications, the following additional assemblies may be needed:

When deploying ASP.NET applications using dotConnect for PostgreSQL SimpleMembership providers, you need to deploy the Devart.Data.PostgreSql.Web.dll assembly for .NET Framework 4, not the one for .NET Framework 2.0. It is located in the Web\ASP.NET 4 subdirectory of the dotConnect for PostgreSQL installation directory (by default, from Program Files\Devart\dotConnect\PostgreSQL\Web\ASP.NET 4) and has the revision number 4 in its version.

When deploying ASP.NET applications using ADO.NET implementation of ASP.NET Identity via dotConnect for PostgreSQL, you need to deploy the Devart.Data.PostgreSql.Web.Identity.dll assembly.

When deploying ASP.NET applications using Entity Framework implementation of ASP.NET Identity via dotConnect for PostgreSQL, you need to deploy the Devart.Data.PostgreSql.Entity.EF6.dll assembly. It is located in the Entity\EF6 subfolder of the dotConnect for PostgreSQL installation folder.

Required Permissions

When dotConnect for PostgreSQL application is used in partially trusted code (this is actual for web projects), it requires medium trust plus SocketPermission.

Since dotConnect for PostgreSQL uses standard Microsoft .NET licensing licensing, it additionally requires RegistryPermission. And though SecurityPermission is granted by default when using medium trust level, the set of flags for the SecurityPermission must be extended. You need to add the following flags: Assertion, SkipVerification, UnmanagedCode, and SerializationFormatter.

For the information on how to do this see Configuring Trust Level for Web Applications.

Entity Framework and LightSwitch Projects

When deploying Entity Framework (or LightSwitch) projects, it is necessary to:

  1. First, you need to check if the Devart.Data.PostgreSql.Entity.EF<Version>.dll assembly is available for your application. The <Version> here is the version of Entity Framework used in your application. For Entity Framework v1 the assembly is called Devart.Data.PostgreSql.Entity.EF1.dll, for Entity Framework v4 it is Devart.Data.PostgreSql.Entity.EF4.dll, for Entity Framework v5 or v6 it is Devart.Data.PostgreSql.Entity.EF5.dll or Devart.Data.PostgreSql.Entity.EF6.dll respectively. For Entity Framework Core it is Devart.Data.PostgreSql.Entity.EFCore.dll. The assembly should reside in the application's folder or in GAC.

    Please note that there are three versions of Devart.Data.PostgreSql.Entity.EFCore.dll assemblies for Full .NET Framework - for different Entity Framework Core versions - 1.1, 2.2, and 3.1. They are located respectively in \Entity\EFCore, \Entity\EFCore2, and \Entity\EFCore3 subfolders of the dotConnect for PostgreSQL installation folder.

    dotConnect for PostgreSQL .NET Standard compatible assemblies for Entity Framework Core are available via NuGet packages, except the Devart.Data.PostgreSql.Entity.EFCore.dll for Entity Framework Core 2. The latter can be found in the \Entity\EFCore2\netstandard2.0 subfolder of the dotConnect for PostgreSQL installation folder.

  2. If you use Code-First Migrations feature of Entity Framework v4 or Entity Framework v5, you also need to check if the Devart.Data.PostgreSql.Entity.Migrations.EF<Version>.dll assembly is available for your application. For Entity Framework v6 this assembly is not needed.
  3. If you use Entity Framework Spatials and NetTopologySuite for Entity Framework v5 or v6, you also need to check if the Devart.Data.PostgreSql.Entity.Spatials.EF<Version>.dll assembly is available for your application.
  4. If you use Entity Framework Core Spatials and NetTopologySuite for Entity Framework Core 3, you need to check if the Devart.Data.PostgreSql.Entity.EFCore3.NetTopologySuite.dll assembly is available for your application. It is located in the \Entity\EFCore3 subfolders of the dotConnect for PostgreSQL installation folder. Additionally, you need to deploy the NetTopologySuite.dll assempbly from the NetTopologySuite 2.1.0 nuget package.
  5. Inform your environment about the provider factory existence (add the entry to the DbProviderFactories section as it is described above).

You can find these assemblies in the Entity folder in the provider installation folder, in the subforder, corresponding to the Entity Framework version necessary.

If you are registering the provider in the machine.config file, please take into account the Entity Framework version. Entity Framework v1 - specific applications require an entry in the .NET Framework 2.0 configuration file, and Entity Framework v4 and later - specific applications should be registered in the .NET Framework 4.0 configuration file. For Entity Framework Core there is no need to register the provider in the machine.config file.

You can also read Microsoft's Deployment Considerations on ADO.NET Entity Framework.

Deploying LightSwitch applications is described here.

LinqConnect Projects

To deploy applications written with LinqConnect support in dotConnect for PostgreSQL, besides deploying the general assemblies you should register run-time LinqConnect assemblies Devart.Data.PostgreSql.Linq.dll and Devart.Data.Linq.dll at Global Assembly Cache (GAC) or place them in the folder of your application (the Bin folder for web projects).

Workflow Foundation Projects

To deploy applications using PostgreSQL Workflow Instance Store or PostgreSQL Workflow Tracking, in addition to the general assemblies, you also need to deploy the Devart.Data.PostgreSql.WorkflowFoundation.dll assembly.

Sync Framework Projects

To deploy applications using Sync Framework, in addition to the general assemblies, you also need to deploy the Devart.Data.Synchronization.dll and Devart.Data.PostgreSql.Synchronization.dll assemblies. Such application also require the Sync Framework itself installed.