public IDictionary <string, object> GetBuildingDynamic( BuildingQueryRow row, BuildingQueryProjection projection, BuildingQueryOptions options) { var obj = new Dictionary <string, object>(); foreach (var f in projection.GetFieldsArr()) { switch (f) { case BuildingQueryProjection.INFO: { var entity = row.Building; obj["id"] = entity.Id; obj["code"] = entity.Code; obj["name"] = entity.Name; obj["description"] = entity.Description; obj["location_id"] = entity.LocationId; } break; case BuildingQueryProjection.LOCATION: { var entity = row.Location; obj["location"] = new { id = entity.Id, name = entity.Name, code = entity.Code }; } break; case BuildingQueryProjection.SELECT: { var entity = row.Building; obj["id"] = entity.Id; obj["name"] = entity.Name; obj["code"] = entity.Code; } break; } } return(obj); }
private BuildingQueryRow ProcessMultiResults(DynamicSql query, object[] objs) { var row = new BuildingQueryRow(); for (var i = 0; i < query.MultiResults.Count; i++) { var r = query.MultiResults[i]; switch (r.Key) { case BuildingQueryProjection.INFO: case BuildingQueryProjection.SELECT: row.Building = objs[i] as Building; break; case BuildingQueryProjection.LOCATION: row.Location = objs[i] as LocationRelationship; break; } } return(row); }