Skip to main content

ADR-005: Data Layer as Shared .NET Standard Project

Status: Proposed
Date: 2026-01-20
Context: Enabling Hybrid Strangler Fig Architecture


Decision

The Data Layer (EITWEP.Model) is extracted as a Shared Library targeting .NET Standard 2.1, enabling consumption by both .NET Framework 4.8 and .NET 8+ applications.

Context

The Hybrid Strangler Fig strategy (ADR-002) requires both legacy and modern applications to share the same data model without code duplication.

Discovery: Entity Framework 6.4.4 (used in EITWEP.Model) is compatible with .NET Standard 2.1, making this extraction possible.

Technical Details

Compatibility Matrix

Component.NET Framework 4.8.NET Standard 2.1.NET 8
EITWEP.Model✅ Current✅ Target✅ Via .NET Standard
Entity Framework 6.4.4
System.Web dependencies⚠️ Must remove

Required Changes

  1. Remove System.Web References: Any HttpContext.Current usage in the Model must be refactored to dependency injection.
  2. Extract to New Project: Create EITWEP.Model.Shared targeting netstandard2.1.
  3. Update References: Both Legacy App and Modern API reference the shared project.

Rationale

Sharing the Data Layer:

  1. Single Source of Truth: No entity drift between apps.
  2. Incremental Migration: Logic can be moved piece by piece.
  3. Testing: Same entities can be tested in both environments.

Consequences

  1. Build Complexity: Multi-targeting requires careful project configuration.
  2. No Breaking Changes: The shared library must maintain backward compatibility.
  3. Future Path: When legacy app is fully strangled, the .NET Standard constraint can be removed.

References