コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }