chore: initial commit
Signed-off-by: Alan Brault <alan.brault@visus.io>
This commit is contained in:
67
sample/MapperSourceGen.Sample/Domain/Customers/Customer.cs
Normal file
67
sample/MapperSourceGen.Sample/Domain/Customers/Customer.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
namespace MapperSourceGen.Sample.Domain.Customers;
|
||||
|
||||
/// <summary>
|
||||
/// Model representing a customer in the system.
|
||||
/// </summary>
|
||||
[Mapper]
|
||||
public sealed class Customer
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the address lines of the customer.
|
||||
/// </summary>
|
||||
public IReadOnlyList<string> AddressLines { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Represents the country of the customer.
|
||||
/// </summary>
|
||||
public string Country { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the date and time when the customer was created.
|
||||
/// </summary>
|
||||
[MapIgnore]
|
||||
public DateTimeOffset Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the unique identifier for the customer.
|
||||
/// </summary>
|
||||
public Guid CustomerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the email address of the customer.
|
||||
/// </summary>
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the first name of the customer.
|
||||
/// </summary>
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the last name of the customer.
|
||||
/// </summary>
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the phone number of the customer.
|
||||
/// </summary>
|
||||
public string Phone { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the postal code of the customer.
|
||||
/// </summary>
|
||||
[MapAlias("ZipCode")]
|
||||
public string PostalCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the state or province of the customer.
|
||||
/// </summary>
|
||||
[MapAlias("State")]
|
||||
public string StateOrProvince { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Represents the date and time when the customer was last updated (nullable).
|
||||
/// </summary>
|
||||
[MapIgnore]
|
||||
public DateTimeOffset? Updated { get; set; }
|
||||
}
|
||||
36
sample/MapperSourceGen.Sample/Domain/Orders/Order.cs
Normal file
36
sample/MapperSourceGen.Sample/Domain/Orders/Order.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace MapperSourceGen.Sample.Domain.Orders;
|
||||
|
||||
/// <summary>
|
||||
/// Model representing an order in the system.
|
||||
/// </summary>
|
||||
[Mapper]
|
||||
public sealed class Order
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the date and time when the order was created.
|
||||
/// </summary>
|
||||
public DateTimeOffset Created { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the unique identifier for the customer associated with the order (nullable).
|
||||
/// </summary>
|
||||
public Guid? CustomerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the unique identifier for the order (private).
|
||||
/// </summary>
|
||||
[MapAlias("EntityId")]
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the unique identifier integer for the order (public).
|
||||
/// </summary>
|
||||
[MapAlias("OrderId")]
|
||||
public int IncrementId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the date and time when the order was last updated.
|
||||
/// </summary>
|
||||
[MapIgnore]
|
||||
public DateTimeOffset? Updated { get; set; }
|
||||
}
|
||||
23
sample/MapperSourceGen.Sample/MapperSourceGen.Sample.csproj
Normal file
23
sample/MapperSourceGen.Sample/MapperSourceGen.Sample.csproj
Normal file
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\MapperSourceGen\MapperSourceGen.csproj"/>
|
||||
|
||||
<!--
|
||||
When referencing a source generator that is part of the solution, ensure that the following properties are set:
|
||||
|
||||
- OutputItemType="Analyzer" to treat it as an analyzer.
|
||||
- SetTargetFramework="TargetFramework=netstandard2.0" to ensure compatibility with the source generator.
|
||||
- ReferenceOutputAssembly="false" to prevent the source generator from being treated as a regular assembly.
|
||||
-->
|
||||
<ProjectReference Include="..\..\src\MapperSourceGen.SourceGenerator\MapperSourceGen.SourceGenerator.csproj"
|
||||
OutputItemType="Analyzer"
|
||||
SetTargetFramework="TargetFramework=netstandard2.0"
|
||||
ReferenceOutputAssembly="false"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
sample/MapperSourceGen.Sample/packages.lock.json
Normal file
10
sample/MapperSourceGen.Sample/packages.lock.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dependencies": {
|
||||
"net8.0": {
|
||||
"mappersourcegen": {
|
||||
"type": "Project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user