Edition 0 Updated to asp. Net core 0


Complex types and/or value objects



Yüklə 11,82 Mb.
Pdf görüntüsü
səhifə191/288
tarix12.07.2023
ölçüsü11,82 Mb.
#136458
1   ...   187   188   189   190   191   192   193   194   ...   288
NET-Microservices-Architecture-for-Containerized-NET-Applications

Complex types and/or value objects
. Discussion in the EF Core GitHub repo (Issues tab) 
https://github.com/dotnet/efcore/issues/246
 

ValueObject.cs.
Base value object class in eShopOnContainers. 
https://github.com/dotnet-
architecture/eShopOnContainers/blob/dev/src/Services/Ordering/Ordering.Domain/SeedWork/
ValueObject.cs
 

ValueObject.cs.
Base value object class in CSharpFunctionalExtensions. 
https://github.com/vkhorikov/CSharpFunctionalExtensions/blob/master/CSharpFunctionalExtensi
ons/ValueObject/ValueObject.cs
 

Address class.
Sample value object class in eShopOnContainers. 
https://github.com/dotnet-
architecture/eShopOnContainers/blob/dev/src/Services/Ordering/Ordering.Domain/Aggregates
Model/OrderAggregate/Address.cs
 


222 
CHAPTER 6 | Tackle Business Complexity in a Microservice with DDD and CQRS Patterns 
Use enumeration classes instead of enum types 
Enumerations
 (or 
enum types
for short) are a thin language wrapper around an integral type. You 
might want to limit their use to when you are storing one value from a closed set of values. 
Classification based on sizes (small, medium, large) is a good example. Using enums for control flow 
or more robust abstractions can be a 
code smell
. This type of usage leads to fragile code with many 
control flow statements checking values of the enum. 
Instead, you can create Enumeration classes that enable all the rich features of an object-oriented 
language. 
However, this isn’t a critical topic and in many cases, for simplicity, you can still use regular 
enum 
types
 if tha
t’s your preference. The use of enumeration classes is more related to business
-related 
concepts. 

Yüklə 11,82 Mb.

Dostları ilə paylaş:
1   ...   187   188   189   190   191   192   193   194   ...   288




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin