SynoLib.Generators.DTOGenerator
1.0.0
dotnet add package SynoLib.Generators.DTOGenerator --version 1.0.0
NuGet\Install-Package SynoLib.Generators.DTOGenerator -Version 1.0.0
<PackageReference Include="SynoLib.Generators.DTOGenerator" Version="1.0.0" />
paket add SynoLib.Generators.DTOGenerator --version 1.0.0
#r "nuget: SynoLib.Generators.DTOGenerator, 1.0.0"
// Install SynoLib.Generators.DTOGenerator as a Cake Addin #addin nuget:?package=SynoLib.Generators.DTOGenerator&version=1.0.0 // Install SynoLib.Generators.DTOGenerator as a Cake Tool #tool nuget:?package=SynoLib.Generators.DTOGenerator&version=1.0.0
DTOGenerator
Source generator that automatically generates DTOs based on existing models Has 4 attributes:
HasDTOAttribute
Use this in classes or structs (not tested in structs) to tell the generator which models should have a DTO
DTOClassName can be set to modify the DTO's name, "[class]" will be substituted by the model's name, the default is [class]DTO
ConversionForm Enum that specifies conversions flags for Model → DTO and DTO → Model. Multiple flags can be set, but Explicit overrides Implicit, and None is Ignored if other flag is set
- None
- Explicit
- Implicit
- StaticMethods
- ReferenceMethods
the default is ConversionForm.Explicit
DTOIgnoreAttribute
Use this in classes/structs properties/fields to ignore them in the final DTO, required members will be set to null
HasConversionAttribute
Specifies that this varible will swich type in this class DTO
hasConversionForm Enum that specifies how the member should be converted, this conversion method should be available in the DTO type of member
- Explicit
- Implicit
- StaticMethods
convertedType Which type the member will be converted to
HasIndirectConversionAttribute
Specifies that this varible will switch type with their DTO type counterpart indirectly
Should be used to convert IEnumerable<TModel> types with their IEnumerable<TDto> counterpart
converterType Type name which has the public static methods that should convert the member atached to this attribute
methodName The name of method that will convert the member original type to the convertedType and vice versa
convertedType The type's fully qualified name that the member will be converted to and from
Disclaimer
Besides being my first, it is my first public library, so feel free to make a issue or pull request to improve it;
Also, the license is a modified version from here
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 124 | 4/13/2024 |
Initial release