1

ProjectA includes EF code, and is normally hosted in MVC project. Now I'd like to "wrap" it in a Azure (v1) function (lets call ProjF), in order to expose on a consumptionplan (so we can scale the heavy calls).

So I ref ProjA, fine. But how to get all the EF settings over? Connectionstring goes via fina via host.settings.json, but the remaining from web.config ? (notice we use PostgresSql and Devart). Since the azure function has no app.config or web.config, these settings has to be set elsewhere.

Relevant sections from web.config:

  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>

and

  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
      <provider invariantName="Devart.Data.PostgreSql" type="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServices, Devart.Data.PostgreSql.Entity.EF6, Version=7.12.1328.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </providers>
  </entityFramework>
  <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.12.1328.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>

Have looked at the solution from How to specify EntityFramework ProviderName in an Azure Function but cannot figure out what values to use since we're using Postgres + Devart

1 Answers1

1

When app.config is not available, you can add register DbProviderFactory and EF6 provider via code. An example is here: https://forums.devart.com/viewtopic.php?t=28550#p97525.

Devart
  • 119,203
  • 23
  • 166
  • 186