How to convert object query to DB query in entity framework <p>I have the following code</p> <pre><code>String entitySQL = "(SELECT o.VehicleTypeID, (o.Engine_Capacity * cast(16039.99 as System.Double) ) " + " FROM CarRentalModelEntities.VehicleTypes AS o where o.VehicleTypeID = 20014) "; query = new ObjectQuery&lt;DbDataRecord&gt;(entitySQL, context); DataRetriever.InitializeTest(context.objectContext.MetadataWorkspace); DataRetriever.GetResultSet(query); xmlRetrievedData = DataRetriever.GetRetrievedTestData(); </code></pre> <p>I want to use DBContext instead of Object Context. How to write the above query using DBQuery? Anyone please help.</p>