diff --git a/example/RapidField.SolidInstruments.Example.Domain.AccessControl/DatabaseContext.cs b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/DatabaseContext.cs
index fc316777..4268272a 100644
--- a/example/RapidField.SolidInstruments.Example.Domain.AccessControl/DatabaseContext.cs
+++ b/example/RapidField.SolidInstruments.Example.Domain.AccessControl/DatabaseContext.cs
@@ -14,6 +14,10 @@
namespace RapidField.SolidInstruments.Example.Domain.AccessControl
{
+ using UserModelConfiguration = Models.User.AggregateDataAccessModelConfiguration;
+ using UserRoleAssignmentModelConfiguration = Models.UserRoleAssignment.AggregateDataAccessModelConfiguration;
+ using UserRoleModelConfiguration = Models.UserRole.AggregateDataAccessModelConfiguration;
+
///
/// Represents a connection to the AccessControl database.
///
@@ -52,19 +56,9 @@ protected override void OnModelCreating(IConfiguration applicationConfiguration,
try
{
_ = modelBuilder
- .Entity(entityType =>
- {
- entityType.HasMany(entity => entity.UserRoleAssignments).WithOne(entity => entity.User);
- })
- .Entity(entityType =>
- {
- entityType.HasMany().WithOne(entity => entity.UserRole).HasForeignKey(entity => entity.UserRoleIdentifier);
- })
- .Entity(entityType =>
- {
- entityType.HasOne(entity => entity.User).WithMany(entity => entity.UserRoleAssignments).HasForeignKey(entity => entity.UserIdentifier);
- entityType.HasOne(entity => entity.UserRole).WithMany().HasForeignKey(entity => entity.UserRoleIdentifier);
- });
+ .ApplyConfiguration(new UserModelConfiguration(applicationConfiguration))
+ .ApplyConfiguration(new UserRoleAssignmentModelConfiguration(applicationConfiguration))
+ .ApplyConfiguration(new UserRoleModelConfiguration(applicationConfiguration));
}
finally
{
diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/User/AggregateDataAccessModelConfiguration.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/User/AggregateDataAccessModelConfiguration.cs
new file mode 100644
index 00000000..4c35af20
--- /dev/null
+++ b/example/RapidField.SolidInstruments.Example.Domain/Models/User/AggregateDataAccessModelConfiguration.cs
@@ -0,0 +1,43 @@
+// =================================================================================================================================
+// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
+// =================================================================================================================================
+
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
+using RapidField.SolidInstruments.DataAccess.EntityFramework;
+using System;
+
+namespace RapidField.SolidInstruments.Example.Domain.Models.User
+{
+ ///
+ /// Encapsulates entity type configuration for the class.
+ ///
+ public sealed class AggregateDataAccessModelConfiguration : DataAccessModelConfiguration
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ ///
+ /// is .
+ ///
+ public AggregateDataAccessModelConfiguration(IConfiguration applicationConfiguration)
+ : base(applicationConfiguration)
+ {
+ return;
+ }
+
+ ///
+ /// Configures the entity.
+ ///
+ ///
+ /// The builder that is used to configure the entity.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration) => _ = entityType.HasMany(entity => entity.UserRoleAssignments).WithOne(entity => entity.User);
+ }
+}
\ No newline at end of file
diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/User/ValueDataAccessModelConfiguration.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/User/ValueDataAccessModelConfiguration.cs
new file mode 100644
index 00000000..620bbcbe
--- /dev/null
+++ b/example/RapidField.SolidInstruments.Example.Domain/Models/User/ValueDataAccessModelConfiguration.cs
@@ -0,0 +1,46 @@
+// =================================================================================================================================
+// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
+// =================================================================================================================================
+
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
+using RapidField.SolidInstruments.DataAccess.EntityFramework;
+using System;
+
+namespace RapidField.SolidInstruments.Example.Domain.Models.User
+{
+ ///
+ /// Encapsulates entity type configuration for the class.
+ ///
+ public sealed class ValueDataAccessModelConfiguration : DataAccessModelConfiguration
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ ///
+ /// is .
+ ///
+ public ValueDataAccessModelConfiguration(IConfiguration applicationConfiguration)
+ : base(applicationConfiguration)
+ {
+ return;
+ }
+
+ ///
+ /// Configures the entity.
+ ///
+ ///
+ /// The builder that is used to configure the entity.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration)
+ {
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/AggregateDataAccessModelConfiguration.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/AggregateDataAccessModelConfiguration.cs
new file mode 100644
index 00000000..b1ff9940
--- /dev/null
+++ b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/AggregateDataAccessModelConfiguration.cs
@@ -0,0 +1,44 @@
+// =================================================================================================================================
+// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
+// =================================================================================================================================
+
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
+using RapidField.SolidInstruments.DataAccess.EntityFramework;
+using System;
+using UserRoleAssignmentModel = RapidField.SolidInstruments.Example.Domain.Models.UserRoleAssignment.AggregateDataAccessModel;
+
+namespace RapidField.SolidInstruments.Example.Domain.Models.UserRole
+{
+ ///
+ /// Encapsulates entity type configuration for the class.
+ ///
+ public sealed class AggregateDataAccessModelConfiguration : DataAccessModelConfiguration
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ ///
+ /// is .
+ ///
+ public AggregateDataAccessModelConfiguration(IConfiguration applicationConfiguration)
+ : base(applicationConfiguration)
+ {
+ return;
+ }
+
+ ///
+ /// Configures the entity.
+ ///
+ ///
+ /// The builder that is used to configure the entity.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration) => _ = entityType.HasMany().WithOne(entity => entity.UserRole).HasForeignKey(entity => entity.UserRoleIdentifier);
+ }
+}
\ No newline at end of file
diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/ValueDataAccessModelConfiguration.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/ValueDataAccessModelConfiguration.cs
new file mode 100644
index 00000000..835db55a
--- /dev/null
+++ b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/ValueDataAccessModelConfiguration.cs
@@ -0,0 +1,46 @@
+// =================================================================================================================================
+// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
+// =================================================================================================================================
+
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
+using RapidField.SolidInstruments.DataAccess.EntityFramework;
+using System;
+
+namespace RapidField.SolidInstruments.Example.Domain.Models.UserRole
+{
+ ///
+ /// Encapsulates entity type configuration for the class.
+ ///
+ public sealed class ValueDataAccessModelConfiguration : DataAccessModelConfiguration
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ ///
+ /// is .
+ ///
+ public ValueDataAccessModelConfiguration(IConfiguration applicationConfiguration)
+ : base(applicationConfiguration)
+ {
+ return;
+ }
+
+ ///
+ /// Configures the entity.
+ ///
+ ///
+ /// The builder that is used to configure the entity.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration)
+ {
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/AggregateDataAccessModelConfiguration.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/AggregateDataAccessModelConfiguration.cs
new file mode 100644
index 00000000..62ddeec6
--- /dev/null
+++ b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/AggregateDataAccessModelConfiguration.cs
@@ -0,0 +1,47 @@
+// =================================================================================================================================
+// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
+// =================================================================================================================================
+
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
+using RapidField.SolidInstruments.DataAccess.EntityFramework;
+using System;
+
+namespace RapidField.SolidInstruments.Example.Domain.Models.UserRoleAssignment
+{
+ ///
+ /// Encapsulates entity type configuration for the class.
+ ///
+ public sealed class AggregateDataAccessModelConfiguration : DataAccessModelConfiguration
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ ///
+ /// is .
+ ///
+ public AggregateDataAccessModelConfiguration(IConfiguration applicationConfiguration)
+ : base(applicationConfiguration)
+ {
+ return;
+ }
+
+ ///
+ /// Configures the entity.
+ ///
+ ///
+ /// The builder that is used to configure the entity.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration)
+ {
+ _ = entityType.HasOne(entity => entity.User).WithMany(entity => entity.UserRoleAssignments).HasForeignKey(entity => entity.UserIdentifier);
+ _ = entityType.HasOne(entity => entity.UserRole).WithMany().HasForeignKey(entity => entity.UserRoleIdentifier);
+ }
+ }
+}
\ No newline at end of file
diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/ValueDataAccessModelConfiguration.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/ValueDataAccessModelConfiguration.cs
new file mode 100644
index 00000000..2439108c
--- /dev/null
+++ b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/ValueDataAccessModelConfiguration.cs
@@ -0,0 +1,46 @@
+// =================================================================================================================================
+// Copyright (c) RapidField LLC. Licensed under the MIT License. See LICENSE.txt in the project root for license information.
+// =================================================================================================================================
+
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using Microsoft.Extensions.Configuration;
+using RapidField.SolidInstruments.DataAccess.EntityFramework;
+using System;
+
+namespace RapidField.SolidInstruments.Example.Domain.Models.UserRoleAssignment
+{
+ ///
+ /// Encapsulates entity type configuration for the class.
+ ///
+ public sealed class ValueDataAccessModelConfiguration : DataAccessModelConfiguration
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ ///
+ /// is .
+ ///
+ public ValueDataAccessModelConfiguration(IConfiguration applicationConfiguration)
+ : base(applicationConfiguration)
+ {
+ return;
+ }
+
+ ///
+ /// Configures the entity.
+ ///
+ ///
+ /// The builder that is used to configure the entity.
+ ///
+ ///
+ /// Configuration information for the application.
+ ///
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration)
+ {
+ return;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/DataAccessModelConfiguration.cs b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/DataAccessModelConfiguration.cs
index d7b7f9d8..dd5f72f5 100644
--- a/src/RapidField.SolidInstruments.DataAccess.EntityFramework/DataAccessModelConfiguration.cs
+++ b/src/RapidField.SolidInstruments.DataAccess.EntityFramework/DataAccessModelConfiguration.cs
@@ -45,13 +45,13 @@ protected DataAccessModelConfiguration(IConfiguration applicationConfiguration)
///
/// Configures the entity.
///
- ///
+ ///
/// The builder that is used to configure the entity.
///
///
/// Configuration information for the application.
///
- protected override void Configure(EntityTypeBuilder builder, IConfiguration applicationConfiguration) => builder.HasKey(model => model.Identifier);
+ protected override void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration) => entityType.HasKey(model => model.Identifier);
///
/// Represents the type of the value that uniquely identifies the data access model.
@@ -89,21 +89,21 @@ protected DataAccessModelConfiguration(IConfiguration applicationConfiguration)
///
/// Configures the entity.
///
- ///
+ ///
/// The builder that is used to configure the entity.
///
- public void Configure(EntityTypeBuilder builder) => Configure(builder, ApplicationConfiguration);
+ public void Configure(EntityTypeBuilder entityType) => Configure(entityType, ApplicationConfiguration);
///
/// Configures the entity.
///
- ///
+ ///
/// The builder that is used to configure the entity.
///
///
/// Configuration information for the application.
///
- protected abstract void Configure(EntityTypeBuilder builder, IConfiguration applicationConfiguration);
+ protected abstract void Configure(EntityTypeBuilder entityType, IConfiguration applicationConfiguration);
///
/// Represents the type of the data access model.