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
I am trying to query children entity with some filtering, but i have no idea how can I pass the parameter to the TypeAdapterConfig.
`
// specification
public CompanyByIdSpec(int id, int teleTypeId)
{
TypeAdapterConfig<Company, QueryCompanyDto>.NewConfig()
.Map(d => d.Teles, s => s.TeleRelations.FirstOrDefault(r => r.teleTypeId== (DefaultIdType)MapContext.Current.Parameters["teleTypeId"]).Teles) ;
// this works but since the selector defined, this is not using ProjectToType in ApplicationDbRepository to map the result from the database, which missing all include statement
Query
.Select(c => c.BuildAdapter().AddParameters("teleTypeId", teleTypeId).Adapt())
.Where(c=>c.id==id);
}
`
but I cannot figure out how can I pass in the "teleTypeId" to the MapContext while keep using ProjectToType in ApplicationDbRepository. how can I do that, thx.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to query children entity with some filtering, but i have no idea how can I pass the parameter to the TypeAdapterConfig.
`
// specification
public CompanyByIdSpec(int id, int teleTypeId)
{
TypeAdapterConfig<Company, QueryCompanyDto>.NewConfig()
.Map(d => d.Teles, s => s.TeleRelations.FirstOrDefault(r => r.teleTypeId== (DefaultIdType)MapContext.Current.Parameters["teleTypeId"]).Teles) ;
// this works but since the selector defined, this is not using ProjectToType in ApplicationDbRepository to map the result from the database, which missing all include statement
Query
.Select(c => c.BuildAdapter().AddParameters("teleTypeId", teleTypeId).Adapt())
.Where(c=>c.id==id);
}
`
but I cannot figure out how can I pass in the "teleTypeId" to the MapContext while keep using ProjectToType in ApplicationDbRepository. how can I do that, thx.
Beta Was this translation helpful? Give feedback.
All reactions