DotNetBrightener.Mapper.Attributes
2026.0.2
See the version list below for details.
dotnet add package DotNetBrightener.Mapper.Attributes --version 2026.0.2
NuGet\Install-Package DotNetBrightener.Mapper.Attributes -Version 2026.0.2
<PackageReference Include="DotNetBrightener.Mapper.Attributes" Version="2026.0.2" />
<PackageVersion Include="DotNetBrightener.Mapper.Attributes" Version="2026.0.2" />
<PackageReference Include="DotNetBrightener.Mapper.Attributes" />
paket add DotNetBrightener.Mapper.Attributes --version 2026.0.2
#r "nuget: DotNetBrightener.Mapper.Attributes, 2026.0.2"
#:package DotNetBrightener.Mapper.Attributes@2026.0.2
#addin nuget:?package=DotNetBrightener.Mapper.Attributes&version=2026.0.2
#tool nuget:?package=DotNetBrightener.Mapper.Attributes&version=2026.0.2
DotNetBrightener.Mapper.Attributes
Copyright © 2017 - 2026 Vampire Coder (formerly DotnetBrightener)
DotNetBrightener.Mapper.Attributes contains the runtime attribute and enum definitions used by the DotNetBrightener.Mapper source generator ecosystem.
This package does not contain the generator itself. It provides the attribute types that your application code references.
Install
If you are using the full mapper package, you typically do not need to install this package directly.
dotnet add package DotNetBrightener.Mapper
Install DotNetBrightener.Mapper.Attributes directly only if you specifically want the attribute definitions without bringing in the full generator package:
dotnet add package DotNetBrightener.Mapper.Attributes
Namespace
using DotNetBrightener.Mapper;
Included Attributes
This package currently exposes:
MappingTargetAttribute<TSource>FlattenAttributeMapFromAttributeMapWhenAttributeGenerateDtosAttributeWrapperAttribute
It also includes these enums:
DtoTypesOutputTypeFlattenNamingStrategy
MappingTarget<TSource>
Use MappingTarget<TSource> to generate a target type from a source type.
[MappingTarget<User>(GenerateToSource = true)]
public partial class UserDto;
Common options include:
ExcludeIncludeIncludeFieldsGenerateConstructorGenerateParameterlessConstructorGenerateProjectionGenerateToSourceConfigurationBeforeMapConfigurationAfterMapConfigurationNestedTargetTypesFlattenToNullablePropertiesPreserveInitOnlyPropertiesPreserveRequiredPropertiesPreserveReferencesMaxDepthConvertEnumsToGenerateCopyConstructorGenerateEqualityChainToParameterlessConstructorCopyAttributesUseFullNameSourceSignature
Example with exclusions and nested targets:
[MappingTarget<Order>(
nameof(Order.InternalNotes),
GenerateToSource = true,
NestedTargetTypes = [typeof(OrderItemDto), typeof(AddressDto)])]
public partial class OrderDto;
Flatten
Use Flatten to generate flattened output types from nested object graphs.
[Flatten(typeof(Order))]
public partial class OrderExportRow;
Useful options include:
ExcludeMaxDepthNamingStrategyIncludeFieldsGenerateParameterlessConstructorGenerateProjectionUseFullNameIgnoreNestedIdsIgnoreForeignKeyClashesIncludeCollections
MapFrom
Use MapFrom on target members to map from a different source member or expression.
[MappingTarget<User>]
public partial class UserDto
{
[MapFrom(nameof(User.DisplayName))]
public string Name { get; set; } = string.Empty;
[MapFrom("FirstName + \" \" + LastName", Reversible = false)]
public string FullName { get; set; } = string.Empty;
}
Key options:
SourceReversibleIncludeInProjection
MapWhen
Use MapWhen to conditionally map a target member.
[MappingTarget<Order>]
public partial class OrderDto
{
[MapWhen("Status == OrderStatus.Completed")]
public DateTime? CompletedAt { get; set; }
}
Key options:
ConditionDefaultIncludeInProjection
GenerateDtos
Use GenerateDtos to generate common DTO shapes from a model.
[GenerateDtos(
Types = DtoTypes.Create | DtoTypes.Update | DtoTypes.Response,
OutputType = OutputType.Record,
ExcludeAuditFields = true)]
public partial class User;
Supported configuration includes:
TypesOutputTypeNamespaceExcludePropertiesExcludeAuditFieldsPrefixSuffixIncludeFieldsGenerateConstructorsGenerateProjectionsUseFullName
Wrapper
Use Wrapper to generate a delegating wrapper around an existing source type instead of copying values into a separate target object.
[Wrapper(typeof(User), nameof(User.PasswordHash))]
public partial class UserWrapper;
Supported configuration includes:
- constructor
sourceType - constructor
exclude IncludeIncludeFieldsReadOnlyNestedWrappersCopyAttributesUseFullName
AOT And Runtime Safety
This package is runtime-safe and lightweight because it contains only attribute and enum definitions. Keeping these definitions separate from the generator avoids pulling Roslyn dependencies into application runtime deployments, including AOT scenarios.
| 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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 (2)
Showing the top 2 NuGet packages that depend on DotNetBrightener.Mapper.Attributes:
| Package | Downloads |
|---|---|
|
DotNetBrightener.Mapper
A Roslyn source generator for models and projections. |
|
|
DotNetBrightener.Mapper.Dashboard
Swagger-like dashboard for visualizing mapper source types and their generated projections in ASP.NET Core applications. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.0.3-preview-777 | 144 | 5/20/2026 |
| 2026.0.3-preview-773 | 154 | 4/24/2026 |
| 2026.0.3-preview-772 | 169 | 4/3/2026 |
| 2026.0.3-preview-770 | 159 | 4/2/2026 |
| 2026.0.3-preview-769 | 147 | 4/2/2026 |
| 2026.0.2 | 155 | 4/2/2026 |
| 2026.0.2-preview-v2026-0-1-755 | 164 | 3/27/2026 |
| 2026.0.2-preview-759 | 163 | 4/1/2026 |
| 2026.0.2-preview-758 | 156 | 3/29/2026 |
| 2026.0.2-preview-757 | 155 | 3/29/2026 |
| 2026.0.2-preview-756 | 158 | 3/27/2026 |
| 2026.0.2-preview-754 | 144 | 3/27/2026 |
| 2026.0.1 | 153 | 3/27/2026 |
| 2026.0.1-preview-752 | 154 | 3/26/2026 |
| 2026.0.1-preview-750 | 156 | 3/26/2026 |
| 2026.0.1-preview-749 | 159 | 3/25/2026 |
| 2026.0.1-preview-748 | 160 | 3/23/2026 |
| 2026.0.1-preview-746 | 126 | 3/22/2026 |
| 2026.0.1-preview-745 | 131 | 3/22/2026 |
| 2025.0.11-preview-776 | 283 | 5/20/2026 |