public IDictionary <string, object> GetDefectTypeDynamic( DefectType row, DefectTypeQueryProjection projection, DefectTypeQueryOptions options) { var obj = new Dictionary <string, object>(); foreach (var f in projection.GetFieldsArr()) { switch (f) { case DefectTypeQueryProjection.INFO: { var entity = row; obj["id"] = entity.Id; obj["name"] = entity.Name; obj["code"] = entity.Code; obj["qc_mapping_code"] = entity.QCMappingCode; obj["description"] = entity.Description; obj["sample_image"] = entity.SampleImage; } break; } } return(obj); }
public static IQueryable <DefectType> Project( this IQueryable <DefectType> query, DefectTypeQueryProjection projection) { foreach (var f in projection.GetFieldsArr()) { if (DefectTypeQueryProjection.MAPS.ContainsKey(f)) { foreach (var prop in DefectTypeQueryProjection.MAPS[f]) { query = query.Include(prop); } } } return(query); }