You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
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?
The text was updated successfully, but these errors were encountered: