ValueOf
Vogen
ValueOf | Vogen | |
---|---|---|
9 | 8 | |
833 | 654 | |
- | - | |
0.0 | 9.0 | |
about 1 year ago | about 18 hours ago | |
C# | C# | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
ValueOf
-
Robust Design through Value Objects in C#
As we anticipate advancements in C#, we can still forge ahead with crafting resilient applications by utilizing the "ValueOf" package as a provisional solution. Below, we create a validated EmailAddress class leveraging the package:
-
Check out new C# 12 preview features! - .NET Blog
Probably better to use something like https://github.com/mcintyre321/ValueOf until we get a better solution (if we ever do). I agree that this is a pitfall.
-
Strong typedefs
The problem you’re describing here I think is ‘primitive obsession’, and the solution you’ve described is I think essentially a value object. This library might be useful https://github.com/mcintyre321/ValueOf
-
New Exception helpers in .NET 8
It lacks compile-time validation (though an analyzer that at least detects validation errors in the constructor should be fairly easy; more complicated flow control cases are probably hard), but at runtime, https://github.com/mcintyre321/ValueOf would let you do that.
- The power of OneOf. Unions for C#
-
Class vs Struct
If you want to wrap a small number of properties in a type to avoid primitive obsession, consider using ValueOf.
-
Is there anyway to override default values of the decimal type in c#?
You might be able to create a wrapper type with something like ValueOf.
-
Primitive Obsession
I good library I've found for addressing this issue is https://github.com/mcintyre321/ValueOf
Vogen
-
Is it just mean, or is C# easier to learn than JavaScript or even PHP?
Check this out: https://github.com/SteveDunn/Vogen
- Primitive obsession
- Where to convert input to Value Object in Clean Architecture?
-
Strong typedefs
There is nothing buildin for this, but take a look at https://github.com/SteveDunn/Vogen
-
The type system is a programmer's best friend
I usually run into issues at the boundaries in the system.
Usually moving from primitives into complex types does not account for serialization and deserialization between db and the client. This can be very annoying to work with in something like C#.
Usually it ends up resulting in alot more types and a lot more mapping between types.
However this has its own benefits, but is very boilerplate-y and is sluggish to work with when your domain changes.
Luckily, for C#, https://github.com/SteveDunn/Vogen now exists thanks to source code generators which soothes some of the issues.
- Vogen - a .NET Source Generator and code analyser for Value Objects
-
Stay safe with your units! Here's how Units of Measure could work in .NET.
Perhaps it could be combined with this: https://github.com/SteveDunn/Vogen So, you could do this:
What are some alternatives?
OneOf - Easy to use F#-like ~discriminated~ unions for C# with exhaustive compile time matching
SiUnits
FSharp.UMX - F# units of measure for primitive non-numeric types
LikeType - Provides 'typedef' type functionality to C#
eShopOnWeb - Sample ASP.NET Core 8.0 reference application, powered by Microsoft, demonstrating a layered application architecture with monolithic deployment model. Download the eBook PDF from docs folder.
EngineeringUnits - Working with units made easy with automatic unit-check and converting between units
TypeScript - TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
coolstore-microservices - A full-stack .NET microservices build on Dapr and Tye
swift-tagged - 🏷 A wrapper type for safer, expressive code.
StringlyTyped - A cure for StringlyTyped software and PrimitiveObsession
common - Gemstone Common Library