By default, Vogen is configured with int type. (Details here)
Current
Currently we can only configure (1) configuration scheme, this is the 'default' Configuration scheme.
Proposed
It would be nice to allow for multiple configuration schemes,
We can define the configuration schemes by Typethis is the current implementation strategy
It would be nice to also have the ability to define by NamedConfiguration, such as how in DI how you can add a NamedService.
Details
This feature request is an expansion on the existing feature 'Configuration' of Vogen.
Existing Feature:
In the current implementation, we can utilize an AssemblyInfo.cs class for pre-configuration of Vogen Value Objects, such as:
// This is my AssemblyInfo.cs file
//--------------------
// Code starts below
//--------------------
// Set the defaults for the project
using Vogen;
[assembly:
VogenDefaults(
typeof(Guid),
Conversions.EfCoreValueConverter | Conversions.NewtonsoftJson | Conversions.TypeConverter |
Conversions.SystemTextJson,
typeof(ValueObjectValidationException))]
Proposed Feature (Pseudo code)
Please take note of these classes:
VogenDefaults <-- Already exists in current implemetantation
VogenConfigs <-- suggested new class to add
// This is my AssemblyInfo.cs file
//--------------------
// Code starts below
//--------------------
// Set the defaults for the project
using Vogen;
// [ValueObject] <--- When this attribute is used, the below config is applied
[assembly:
VogenDefaults(
typeof(Guid),
Conversions.EfCoreValueConverter | Conversions.NewtonsoftJson | Conversions.TypeConverter |
Conversions.SystemTextJson,
typeof(ValueObjectValidationException))]
// This example here might be confusing,.... or maybe its handy.
// [ValueObject<Guid>] <--- When this attribute is used, the below config is applied
[assembly:
VogenConfigs(
typeof(Guid),
Conversions.TypeConverter | Conversions.NewtonsoftJson ,
typeof(SomeOtherErrorException))]
// [ValueObject<string>] <--- When this attribute is used, the below config is applied
[assembly:
VogenConfigs(
typeof(string),
Conversions.SystemTextJson,
typeof(RandomException))]
// [ValueObject<int>] <--- When this attribute is used, the below config is applied
[assembly:
VogenConfigs(
typeof(int),
Conversions.EfCoreValueConverter | Conversions.NewtonsoftJson
Conversions.SystemTextJson,
typeof(OtherException))]
// I don't really like using string literals. Perhaps we can extract these to a type like what is suggested ==>
// https://github.com/SteveDunn/Vogen/issues/327
//----
// The example implementation would be:
// [ValueObject<int, MyStronglyTypedNameConfig>] <-- Jeff votes for this
// / [ValueObject<int, MyStronglyTypedNameConfig>] <--- When this attribute is used, the below config is applied
// or
// [ValueObject<int>("MyStronglyTypedName")] <--- When this attribute is used, the below config is applied
[assembly:
VogenConfigs(
"MyStronglyTypedName", typeof(int),
Conversions.EfCoreValueConverter | Conversions.NewtonsoftJson | Conversions.TypeConverter |
Conversions.SystemTextJson,
typeof(XyzException))]
// / [ValueObject<int, MyOtherStronglyTypedNameConfig>] <--- When this attribute is used, the below config is applied
// or
// [ValueObject<int>("MyOtherStronglyTypedName")] <--- When this attribute is used, the below config is applied
[assembly:
VogenConfigs(
"MyOtherStronglyTypedName", typeof(int),
Conversions.EfCoreValueConverter
Conversions.SystemTextJson,
typeof(AbcException))]
Please let me know what you guys think, and if there are any questions or suggestions, please feel free to be chatty about it.
Thanks @jeffward01 - certainly something to think about. I'm a bit snowed under at the moment, but this could certainly be a useful addition! Thanks again.
Describe the feature
Hello all,
Feature Title: Multiple pre-defined configurations
Summary:
By default,
Vogen
is configured withint
type. (Details here)Current
Proposed
Type
this is the current implementation strategyNamedConfiguration
, such as how in DI how you can add aNamedService
.Details
This feature request is an expansion on the existing feature 'Configuration' of
Vogen
.Existing Feature:
In the current implementation, we can utilize an
AssemblyInfo.cs
class for pre-configuration ofVogen
Value Objects, such as:Proposed Feature (Pseudo code)
Please take note of these classes:
VogenDefaults
<-- Already exists in current implemetantationVogenConfigs
<-- suggested new class to addPlease let me know what you guys think, and if there are any questions or suggestions, please feel free to be chatty about it.
Thanks so much!