Skip to content

Commit b36dec6

Browse files
renemadsenclaude
andcommitted
fix(plugins): share BaseDbContext type across plugin ALCs
Without sharing, each plugin loads its own BaseDbContext Type in an isolated AssemblyLoadContext, so plugin services cannot resolve the host's BaseDbContext DI registration. Required once the host stopped re-registering BaseDbContext in each plugin's ConfigureDbContext. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4682a72 commit b36dec6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

eFormAPI/eFormAPI.Web/Hosting/Helpers/PluginHelper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2525

2626
namespace eFormAPI.Web.Hosting.Helpers;
2727

28+
using Microting.EformAngularFrontendBase.Infrastructure.Data;
2829
using Microting.EformAngularFrontendBase.Infrastructure.Data.Entities;
2930
using Microting.EformAngularFrontendBase.Infrastructure.Data.Factories;
3031
using System;
@@ -317,6 +318,11 @@ private static List<IEformPlugin> LoadAllPluginsFromDisk()
317318
typeof(PluginConfigurationProvider<>),
318319
typeof(ConfigurationProvider),
319320
typeof(DbContext),
321+
// Share Microting.EformAngularFrontendBase so the plugin's BaseDbContext
322+
// is the same Type object the host registers in DI. Without this, each
323+
// plugin loads its own copy of BaseDbContext in a separate ALC, and
324+
// plugin services cannot resolve the host's BaseDbContext registration.
325+
typeof(BaseDbContext),
320326
typeof(WarningsConfiguration),
321327
typeof(WarningBehavior),
322328
typeof(DbContextOptionsBuilder),

0 commit comments

Comments
 (0)