最终,我确实找到了一个很好的解决方案。答案是简单地使LINQ to SQL成为可能。像这样:
using (MyDataContext context = CreateDataContext()){ // Set the load options for the query (these tell LINQ that the // DataNode object will have an associated DataObject object just // as before). context.LoadOptions = StaticLoadOptions; // Run a plain old SQL query on our context. LINQ will use the // results to populate the node object (including its DataObject // property, thanks to the load options). DataNode node = context.ExecuteQuery<DataNode>( "SELECt * FROM Node INNER JOIN Object " + "ON Node.ObjectId = Object.ObjectId " + "WHERe ObjectId = @p0", objectId).FirstOrDefault(); //...}


