Skip to content

Commit

Permalink
Merge pull request #191 from TimeWarpEngineering/Cramer/2024-03-27/Re…
Browse files Browse the repository at this point in the history
…cordToClass

Cramer/2024 03 27/record to class
  • Loading branch information
StevenTCramer committed May 4, 2024
2 parents a94c4f8 + 657ae12 commit 9339f4e
Show file tree
Hide file tree
Showing 150 changed files with 2,620 additions and 331 deletions.
11 changes: 0 additions & 11 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -151,17 +151,6 @@ dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.constant_style.capitalization = pascal_case

# Static fields are camelCase and start with s_
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style

dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_field_style.capitalization = pascal_case
dotnet_naming_style.static_field_style.required_prefix = s_

# local variables should be camelCase
dotnet_naming_rule.camel_case_for_local_variables.severity = suggestion
dotnet_naming_rule.camel_case_for_local_variables.symbols = local_variables
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
root = true
# EditorConfig is awesome:http://EditorConfig.org
# For dotnet and Csharp specific see below
# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference

# Remove the line below if you want to inherit .editorconfig settings from higher directories
# top-most EditorConfig file
root = true

#### Core EditorConfig Options ####

Expand Down Expand Up @@ -225,16 +225,15 @@ dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.constant_style.capitalization = pascal_case

# Static fields are camelCase and start with s_
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
# Static fields are PascalCase
dotnet_naming_rule.static_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_pascal_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_pascal_case.style = static_field_style

dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_field_style.capitalization = pascal_case
dotnet_naming_style.static_field_style.required_prefix = s_

# local variables should be camelCase
dotnet_naming_rule.camel_case_for_local_variables.severity = suggestion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,7 @@ GeneratedCode/
.tye/
/Source/ContainerApps/Web/Web.Contracts/Generated/**
/Source/ContainerApps/Web/Web.Spa/Generated/**
/Source/ContainerApps/Web/Web.Server/Generated/**
/Tests/TimeWarp.Testing/Generated/**
/Source/ContainerApps/Web/Web.Server/Logs/log.txt
/Source/ContainerApps/Api/Api.Contracts/Generated/**
Original file line number Diff line number Diff line change
@@ -1,76 +1,82 @@
<Project>
<ItemGroup>
<PackageVersion Include="Ardalis.GuardClauses" Version="4.5.0" />
<PackageVersion Include="Asp.Versioning.Http" Version="7.0.0" />
<PackageVersion Include="Asp.Versioning.Mvc" Version="7.0.0" />
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="AutoFixture.AutoFakeItEasy" Version="4.18.1" />
<PackageVersion Include="AutoMapper" Version="12.0.1" />
<PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.2.2" />
<PackageVersion Include="Azure.Identity" Version="1.10.4" />
<PackageVersion Include="Blazor-State" Version="11.0.0-beta.25" />
<PackageVersion Include="Azure.Identity" Version="1.11.2" />
<PackageVersion Include="Blazor-State" Version="11.0.0-beta.31" />
<PackageVersion Include="BlazorComponentUtilities" Version="1.8.0" />
<PackageVersion Include="Dawn.Guard" Version="1.12.0" />
<PackageVersion Include="FakeItEasy" Version="8.0.0" />
<PackageVersion Include="FakeItEasy" Version="8.2.0" />
<PackageVersion Include="Fixie" Version="3.4.0" />
<PackageVersion Include="Fixie.TestAdapter" Version="3.4.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FluentValidation" Version="11.8.1" />
<PackageVersion Include="FluentValidation" Version="11.9.1" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.5.2" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.1" />
<PackageVersion Include="GlobalUsingsAnalyzer" Version="1.4.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.59.0" />
<PackageVersion Include="Grpc.AspNetCore.Server.Reflection" Version="2.59.0" />
<PackageVersion Include="Grpc.AspNetCore.Web" Version="2.59.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.59.0" />
<PackageVersion Include="Grpc.Net.Client.Web" Version="2.59.0" />
<PackageVersion Include="Grpc.AspNetCore" Version="2.62.0" />
<PackageVersion Include="Grpc.AspNetCore.Server.Reflection" Version="2.62.0" />
<PackageVersion Include="Grpc.AspNetCore.Web" Version="2.62.0" />
<PackageVersion Include="Grpc.Net.Client" Version="2.62.0" />
<PackageVersion Include="Grpc.Net.Client.Web" Version="2.62.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="MediatR.Contracts" Version="2.0.1" />
<PackageVersion Include="MicroElements.Swashbuckle.FluentValidation" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" />
<PackageVersion Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.8.0" />
<PackageVersion Include="Microsoft.Authentication.WebAssembly.Msal" Version="8.0.4" />
<PackageVersion Include="Microsoft.Azure.AppConfiguration.AspNetCore" Version="7.2.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="4.9.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="8.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.4" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.4" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.FeatureManagement.AspNetCore" Version="2.5.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.5.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.5.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.5.0" />
<PackageVersion Include="Microsoft.Playwright" Version="1.40.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.7.2" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.6.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.7.2" />
<PackageVersion Include="Microsoft.Identity.Web" Version="2.18.1" />
<PackageVersion Include="Microsoft.Playwright" Version="1.43.0" />
<PackageVersion Include="Microsoft.Tye.Extensions.Configuration" Version="0.10.0-alpha.21420.1" />
<PackageVersion Include="Microsoft.TypeScript.MSBuild" Version="4.6.2" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageVersion Include="Morris.Blazor.ControlFlow" Version="2.0.0" />
<PackageVersion Include="Morris.Blazor.FluentValidation" Version="3.0.0" />
<PackageVersion Include="Morris.Moxy" Version="1.8.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageVersion Include="Morris.Moxy" Version="1.10.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageVersion Include="Oakton" Version="6.1.0" />
<PackageVersion Include="Octokit.Webhooks.AspNetCore" Version="1.0.0" />
<PackageVersion Include="OneOf" Version="3.0.263" />
<PackageVersion Include="OneOf.SourceGenerator" Version="3.0.243" />
<PackageVersion Include="Riok.Mapperly" Version="3.3.0" />
<PackageVersion Include="Riok.Mapperly" Version="3.5.1" />
<PackageVersion Include="Scrutor" Version="4.2.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="Serilog.Enrichers.Environment" Version="2.3.0" />
<PackageVersion Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Formatting.Compact" Version="2.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.3.1" />
<PackageVersion Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageVersion Include="Swashbuckle.AspNetCore.Filters" Version="7.0.2" />
Expand All @@ -82,14 +88,14 @@
<PackageVersion Include="System.ServiceModel.Primitives" Version="8.0.0" />
<PackageVersion Include="TimeWarp.Fixie" Version="1.0.2" />
<PackageVersion Include="TimeWarp.SourceGenerators" Version="1.0.0-alpha.5" />
<PackageVersion Include="TimeWarp.State.Plus" Version="11.0.0-beta.24" />
<PackageVersion Include="TimeWarp.State.Plus" Version="11.0.0-beta.31" />
<PackageVersion Include="Timewarp.OptionsValidation" Version="1.0.0-alpha.2" />
<PackageVersion Include="Yarp.ReverseProxy" Version="2.1.0" />
<PackageVersion Include="protobuf-net.Grpc" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Grpc.Reflection" Version="1.1.1" />
<PackageVersion Include="timewarp-heroicons" Version="2.0.19" />
<PackageVersion Include="timewarp-simple-icons" Version="9.9.0" />
<PackageVersion Include="timewarp-simple-icons" Version="11.11.0" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ADR-001: Region Naming and Usage in Entity Classes

* Status: proposed
* Deciders: Architect
* Consulted: Amina
* Date: 2024-03-05

## Context

In our object-oriented design, we have various types of associations between entities, including Composite, Aggregate, and Normal associations. These associations can be represented in code using properties, but without clear organization, the code can become difficult to understand and maintain.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Standardizing Assembly Identification with AssemblyMarker

* Status: accepted
* Deciders: Architecture Team, Development Team Leads
* Deciders: Architect
* Consulted: Amina
* Date: 2024-03-05

## Context and Problem Statement
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Choosing an Endpoint-Centric API Design Enhanced by Interface-Based Validation

* Status: accepted
* Deciders: Architect
* Consulted: Amina
* Date: 2024-04-01

## Context and Problem Statement

When designing a new API, a critical decision involves selecting a design pattern that will shape our approach to creating API Contracts (Commands, Queries, DTOs, and validation). The choice between endpoint-centric and entity-centric designs significantly affects aspects such as coupling, flexibility, maintenance, and the ease of integration with front-end systems. We aim to select a pattern that optimizes these aspects while aligning with our strategic goals.

## Decision Drivers

* Requirement to maintain high flexibility and specificity for each endpoint.
* Minimize coupling between endpoints to enhance API resilience and scalability.
* Prevent over-fetching or under-fetching of data to optimize performance and resource usage.
* Requirement for consistent, functional data validation mechanisms across server-side contracts.
* Need for data binding strategies that ensure functional binding of Blazor forms to the Commands and Queries of the API Contracts.
* Desire to ensure ease of maintenance and comprehensibility of the API.

## Considered Options

* **Entity-Centric API Design**: Utilizes shared DTOs across multiple endpoints.
* **Endpoint-Centric API Design without Interface Validation**: Uses separate DTOs for each endpoint without shared validation.
* **Endpoint-Centric API Design with Interface Validation**: Uses separate DTOs for each endpoint but with shared structure and validation logic through interfaces.

## Decision Outcome

Chosen option: 'Endpoint-Centric API Design with Interface Validation.' This approach best aligns with our goals by maintaining endpoint specificity and flexibility while centralizing and simplifying validation logic. It also supports decoupling of endpoints, allowing for modifications to one endpoint without impacting others, thereby enhancing system robustness. Furthermore, this design facilitates more consistent data binding with UI components, reducing redundant code and improving maintainability.

### Positive Consequences

* **Enhanced Endpoint Flexibility**: Each endpoint can be independently developed and modified without risk of affecting others, thanks to the decoupling provided by interface-based validation. This flexibility allows the API to evolve more dynamically and responsively to changing business needs.
* **Reduced Code Redundancy**: By using shared interfaces for common validation rules, the API reduces the need for repeated code across different endpoints, leading to cleaner, more maintainable codebases.
* **Improved Data Integrity and Validation Efficiency**: Interfaces ensure that validation logic is consistently applied across all relevant endpoints, enhancing data integrity and reducing the likelihood of errors. This structured approach also speeds up the validation process, as it leverages a unified set of rules.
* **Streamlined Client Integration**: The consistent data structure and validation rules facilitated by interfaces make it easier for client-side applications, particularly those using Blazor, to bind forms to API commands and queries. This results in a smoother development experience and faster feature integration.

### Negative Consequences

* **Pattern Familiarization**: The primary challenge lies in understanding and adopting the endpoint-centric design pattern with interface validation. While this approach offers significant architectural benefits, it demands proficiency in its principles and practical applications. This learning curve is mitigated by the examples and documentation included in the TimeWarp Architecture.

## Pros and Cons of the Options

### Entity-Centric API Design

* Good, because it simplifies the API model by reducing the number of DTOs.
* Bad, because it couples the DTOs across multiple endpoints, potentially leading to less flexibility.
* Bad, because it may lead to less flexibility in tailoring data structures to specific endpoint needs.
* Bad, because it can result in over-fetching of data.

### Endpoint-Centric API Design without Interface Validation

* Good, because it ensures maximum flexibility and control over each endpoint's data contracts.
* Bad, because it leads to potential redundancy in validation logic across similar DTOs.
* Bad, because it complicates form data binding in the UX.

### Endpoint-Centric API Design with Interface Validation

* Good, because it maintains the flexibility of endpoint-specific DTOs while centralizing common validation logic.
* Good, because it streamlines integration with UI by standardizing data binding practices.

## Links

* [API Design](../ApiDesign.md)
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# {short title of solved problem and solution}

* Status: {proposed | rejected | accepted | deprecated | … | superseded by [ADR-0005](0005-example.md)} <!-- optional -->
* Deciders: {list everyone involved in the decision} <!-- optional -->
* Architect: {primary decision maker} <!-- required -->
* Consulted: {list of people whose inputs were considered} <!-- optional -->
* Date: {YYYY-MM-DD when the decision was last updated} <!-- optional -->

Technical Story: {description | ticket/issue URL} <!-- optional -->
Expand Down
Loading

0 comments on commit 9339f4e

Please sign in to comment.