public IDictionary <string, object> GetAreaDynamic( AreaQueryRow row, AreaQueryProjection projection, AreaQueryOptions options) { var obj = new Dictionary <string, object>(); foreach (var f in projection.GetFieldsArr()) { switch (f) { case AreaQueryProjection.INFO: { var entity = row.Area; obj["id"] = entity.Id; obj["name"] = entity.Name; obj["description"] = entity.Description; obj["floor_id"] = entity.FloorId; obj["building_id"] = entity.BuildingId; obj["location_id"] = entity.LocationId; obj["archived"] = entity.Archived; obj["code"] = entity.Code; } break; case AreaQueryProjection.SELECT: { var entity = row.Area; obj["id"] = entity.Id; obj["name"] = entity.Name; obj["code"] = entity.Code; } break; case AreaQueryProjection.FLOOR: { var entity = row.Floor; obj["floor"] = new { id = entity.Id, name = entity.Name, code = entity.Code, }; } break; case AreaQueryProjection.BUILDING: { var entity = row.Building; obj["building"] = new { id = entity.Id, name = entity.Name, code = entity.Code, }; } break; } } return(obj); }
private AreaQueryRow ProcessMultiResults(DynamicSql query, object[] objs) { var row = new AreaQueryRow(); for (var i = 0; i < query.MultiResults.Count; i++) { var r = query.MultiResults[i]; switch (r.Key) { case AreaQueryProjection.INFO: case AreaQueryProjection.SELECT: row.Area = objs[i] as Area; break; case AreaQueryProjection.FLOOR: row.Floor = objs[i] as FloorRelationship; break; case AreaQueryProjection.BUILDING: row.Building = objs[i] as BuildingRelationship; break; } } return(row); }