This commit is contained in:
Wvader 2021-12-11 11:51:54 +00:00
parent 9470afb737
commit 31ac58f274
8 changed files with 23 additions and 23 deletions

View File

@ -36,6 +36,8 @@ namespace MapTo.Extensions
.WriteComment($" Type {item.Type}")
.WriteComment($" MappedSourcePropertyTypeName {item.MappedSourcePropertyTypeName}")
.WriteComment($" IsEnumerable {item.IsEnumerable}")
.WriteComment($" FullyQualifiedType {item.FullyQualifiedType}")
.WriteComment($" EnumerableTypeArgument {item.EnumerableTypeArgument}")
.WriteComment($" SourcePropertyName {item.SourcePropertyName}")
.WriteComment($" TypeSymbol {item.FullyQualifiedType.ToString()}")
.WriteComment($" isReadOnly {item.isReadOnly.ToString()}")

View File

@ -10,7 +10,7 @@ namespace MapTo.Extensions
{
internal static SourceCode GenerateStructOrClass(this MappingModel model, string structOrClass)
{
const bool writeDebugInfo = false;
const bool writeDebugInfo = true;
using var builder = new SourceBuilder()
.WriteLine(GeneratedFilesHeader)
@ -66,7 +66,7 @@ namespace MapTo.Extensions
foreach (var property in model.TypeProperties)
{
if (!model.SourceProperties.IsMappedProperty(property))
if (!model.TypeProperties.IsMappedProperty(property))
{
stringBuilder.Append(", ");
stringBuilder.Append($"{property.FullyQualifiedType} {property.SourcePropertyName.ToCamelCase()}");
@ -88,7 +88,7 @@ namespace MapTo.Extensions
foreach(var prop in properties)
{
if (prop.FullyQualifiedType == property.FullyQualifiedType) return true;
if (prop.FullyQualifiedType.ToString() == property.FullyQualifiedType.ToString()) return true;
}
return false;

View File

@ -20,6 +20,7 @@ namespace BlueWest.Data
Sell
}
[MapFrom(typeof(FinanceTransactionInsertDto))]
public partial struct FinanceTransaction
{
public int Id { get; }

View File

@ -0,0 +1,16 @@
using System;
namespace BlueWest.Data
{
public partial struct FinanceTransactionInsertDto
{
public int UserId { get; set; }
public FinanceTransactionType FinanceTransactionType { get; }
public FinanceSymbol FinanceSymbol { get; }
public double Amount { get; } // To Buy
public double Quantity { get; } // Bought
public double Fee { get; }
public DateTime DateTime { get; }
}
}

View File

@ -7,9 +7,8 @@ namespace BlueWest.Data
{
[MapFrom(typeof(FinanceTransaction))]
public partial struct FinanceTransactionReadDto
partial struct FinanceTransactionReadDto
{
public int Id { get; set; }
public int UserId { get; set; }
public FinanceTransactionType FinanceTransactionType { get; }
public FinanceSymbol FinanceSymbol { get; }

View File

@ -11,7 +11,6 @@ namespace BlueWest.Data
Users = users;
}
public int Length => Users.Count;
}
}

View File

@ -15,7 +15,5 @@ namespace BlueWest.Data
public double BTCAmount { get; set; }
public double LTCAmount { get; set; }
}
}

View File

@ -1,15 +0,0 @@
using System;
using BlueWest.Data;
using MapTo;
using TestConsoleApp.Data.Models;
namespace TestConsoleApp.ViewModels
{
[MapFrom(typeof(User))]
public partial struct UserViewModel
{
public int Id { get; set; }
public DateTimeOffset RegisteredAt { get; }
}
}