标签:tar 查询 article query start rac his mod 执行
在EF编程中我们能够通过lamda表达式能够进行查询数据。获取到IQueryable<T>结果,我们要想知道详细的SQL语句是什么须要使用ObjectQuery<T>进行处理
处理方法例如以下:
IQueryable<Data> data = this.ObjectContext.Data.Where(d => d.Name.StartsWith("測试")); ObjectQuery<Data> oq=data as ObjectQuery<Data>; String sql=oq.ToTraceString();
SELECT [Extent1].[ID] AS [ID], [Extent1].[Name] AS [Name] FROM (SELECT [Data].[ID] AS [ID], [Data].[Name] AS [Name] FROM [dbo].[Data] AS [Data]) AS [Extent1] WHERE [Extent1].[Name] LIKE '測试%'
标签:tar 查询 article query start rac his mod 执行
原文地址:http://www.cnblogs.com/lytwajue/p/7218198.html