-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Description
var sql = @"select p.*,
a.""Id"" as ""Analysis_Id"",
a.""Name"" as ""Analysis_Name"",
a.""SortOrder"" as ""Analysis_SortOrder""
from ""Product"" p
left join ""Analysis"" a on p.""AnalysisId"" = a.""Id""
where p.""CategoryId"" = :CategoryId";
IEnumerable<dynamic> dynamicProducts = await
sqlConnection.QueryAsync<dynamic>(
sql,
new
{
CategoryId = categoryId
});
var products = AutoMapper.MapDynamic<Product>(dynamicProducts).ToList();
return products;
public class Product
{
public long Id { get; set; }
public long OFId { get; set; }
public string Header { get; set; }
public string Description { get; set; }
public int CategoryId { get; set; }
public Analysis Analysis { get; set; }
public bool IsActive { get; set; }
}
If AnalysisId is null, then Slapper.Automapper creates a new object with default values. How am I supposed to make it set Analysis to null instead of a "nulled" object?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels