B
Billy_1991
Guest
Hello everyone,
This simple code causes strange issues:
private IEnumerable<Company+DTO> Map(IEnumerable<Company> companies)
{
try
{
var result = companies.Select(c => Map(c));
foreach (CompanyDTO c in result)
c.HasChildrens = companies.Any(cc => cc.ParentCompanyId == c.Id); // here code breaks
return result;
}
catch (Exception ex)
{
}
return null;
}
Basically I'm just "converting" Company to CompanyDTO in my Map method and after that I'm looping that "converted" list to set HasChildrens property because I couldn't set it in Map method cuz Company class does not contain that prop (I want it only in DTO because thats class that user will see).
Issue is : Npgsql.NpgsqlOperationInProgressException: A command is already in progress
Continue reading...
This simple code causes strange issues:
private IEnumerable<Company+DTO> Map(IEnumerable<Company> companies)
{
try
{
var result = companies.Select(c => Map(c));
foreach (CompanyDTO c in result)
c.HasChildrens = companies.Any(cc => cc.ParentCompanyId == c.Id); // here code breaks
return result;
}
catch (Exception ex)
{
}
return null;
}
Basically I'm just "converting" Company to CompanyDTO in my Map method and after that I'm looping that "converted" list to set HasChildrens property because I couldn't set it in Map method cuz Company class does not contain that prop (I want it only in DTO because thats class that user will see).
Issue is : Npgsql.NpgsqlOperationInProgressException: A command is already in progress
Continue reading...