AutoDto 1.0.1
See the version list below for details.
dotnet add package AutoDto --version 1.0.1
NuGet\Install-Package AutoDto -Version 1.0.1
<PackageReference Include="AutoDto" Version="1.0.1" />
paket add AutoDto --version 1.0.1
#r "nuget: AutoDto, 1.0.1"
// Install AutoDto as a Cake Addin
#addin nuget:?package=AutoDto&version=1.0.1
// Install AutoDto as a Cake Tool
#tool nuget:?package=AutoDto&version=1.0.1
AutoDto
This tool allows to auto create DTO model from BL model in compile time.
It supports different strategies for relations, such as ReplaceToIdProperty, AddIdProperty and ReplaceToDtoProperty
Setup
To use AutoDto, first install the NuGet package:
dotnet add package AutoDto
- Declare partial DTO type like
public partial SomeDto {}
- Add attribute
[DtoFrom(typeof(SomeBlType))]
- Build project
Full simple setup:
[DtoFrom(typeof(SomeBlType))]
public partial SomeDto {}
AutoDto tool will generate partial SomeDto class with all public properties from SomeBlType.
Relation Strategies
Relation strategy means what to do with relation property during generating DTO.
Supported strategies:
- None
- ReplaceToIdProperty
- AddIdProperty
- ReplaceToDtoProperty
Usage
Set strategy in [DtoFrom]
attribute after BL type.
[DtoFrom(typeof(SomeBlType), RelationStrategy.AddIdProperty)]
public partial SomeDto {}
If not specified - RelationStrategy.None will be used
None
DTO will have property on BL type
ReplaceToIdProperty
If BL relation property has Id
property:
DTO will have only RelationPropNameId property of BL relation Id prop type.
If BlType has relation with array or enumerable - generated name will be RelationPropNameIds
❗ If no
Id
found in relation entity - result will be same as with None strategy
AddIdProperty
DTO will have relation type property and Id
property is found
ReplaceToDtoProperty
Try find DTO, generated for RelationType and replace to RelationTypeDto.
❗ If many DTOs exists for RelationType - use
[MainDto]
attribute to mark which one should be used inReplaceToDtoProperty
Ignore properties
To avoid some properties from BlType, use [DtoIgnore]
attribute:
[DtoFrom(typeof(SomeBlType), RelationStrategy.AddIdProperty)]
[DtoIgnore(nameof(SomeBlType.PropName1), nameof(SomeBlType.PropName2))]
public partial SomeDto {}
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
- AutoDto.Setup (>= 1.0.0)
- Microsoft.CodeAnalysis.CSharp (>= 4.5.0)
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 |
---|---|---|
2.1.0 | 889 | 6/1/2023 |
2.0.1 | 130 | 5/4/2023 |
2.0.0 | 159 | 4/26/2023 |
2.0.0-beta-2 | 124 | 4/24/2023 |
2.0.0-beta | 125 | 4/24/2023 |
1.0.8 | 182 | 4/18/2023 |
1.0.7 | 162 | 4/18/2023 |
1.0.6 | 137 | 4/18/2023 |
1.0.5 | 159 | 4/18/2023 |
1.0.4 | 152 | 4/18/2023 |
1.0.3 | 178 | 4/18/2023 |
1.0.2 | 174 | 4/18/2023 |
1.0.1 | 147 | 4/18/2023 |
1.0.0 | 155 | 4/18/2023 |