Solve issue with PgSqlEntityProviderServicesConfiguration being discovered too late
Posted: Thu 15 Nov 2018 23:04
I'm just sharing this here so someone else doesn't fall into the same pit.
Occasionally I was getting an exception raised:
To fix this, add codeConfigurationType attribute to the web config entityFramework element
This is a more reliable way to determine the Configuration type.
Alternatively, this could have been solve also by adding the DbConfigurationType attribute on the DbContext
see details at https://docs.microsoft.com/en-au/ef/ef6 ... code-based
Occasionally I was getting an exception raised:
Code: Select all
System.InvalidOperationException: 'The default DbConfiguration instance was used by the Entity Framework
before the 'PgSqlEntityProviderServicesConfiguration' type was discovered.
An instance of 'PgSqlEntityProviderServicesConfiguration' must be set at application start before using any
Entity Framework features or must be registered in the application's config file.
See http://go.microsoft.com/fwlink/?LinkId=260883 for more information.'
Code: Select all
<entityFramework codeConfigurationType="Devart.Data.PostgreSql.Entity.PgSqlEntityProviderServicesConfiguration, Devart.Data.PostgreSql.Entity">
Alternatively, this could have been solve also by adding the DbConfigurationType attribute on the DbContext
Code: Select all
using Devart.Data.PostgreSql.Entity;
namespace IdentityServer3.EntityFramework
{
[DbConfigurationType(typeof(PgSqlEntityProviderServicesConfiguration))]
public class BaseDbContext : DbContext
...