本文整理汇总了C#中IQueryable.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# IQueryable.ToString方法的具体用法?C# IQueryable.ToString怎么用?C# IQueryable.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IQueryable
的用法示例。
在下文中一共展示了IQueryable.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DebugWriteQuery
public static void DebugWriteQuery(IQueryable query)
{
#if DEBUG
// プロトタイプではデバッガに出力
var oQuery = query as ObjectQuery;
if (oQuery != null)
{
System.Diagnostics.Trace.WriteLine(oQuery.ToTraceString());
}
else
{
System.Diagnostics.Trace.WriteLine(query.ToString());
}
#endif
}
示例2: ExecuteQuery
public static List<Package> ExecuteQuery(IQueryable<Package> query, TextWriter log, bool verbose)
{
if (verbose)
{
log.WriteLine(query.ToString());
}
DateTime before = DateTime.Now;
List<Package> list = query.ToList();
DateTime after = DateTime.Now;
log.WriteLine("Packages: {0} rows returned, duration {1} seconds", list.Count, (after - before).TotalSeconds);
return list;
}
示例3: QueryTest
private static void QueryTest(IQueryable<Question> query, IEnumerable<string> expected, string assertMessage)
{
var actual = query.ToString();
Assert.IsTrue(expected.Contains(actual, StringComparer.InvariantCultureIgnoreCase), assertMessage);
}
开发者ID:efrGas,项目名称:net-training-master-36e6aeeb22ad48924667c891c0a7152db767bcaf,代码行数:5,代码来源:QueryableTests.cs
示例4: TrimQueryText
private static string TrimQueryText(IQueryable<WorkItem> actual)
{
string actualWiql = string.Join(" ", actual.ToString().Split(new string[] { Environment.NewLine, " " }, StringSplitOptions.RemoveEmptyEntries).ToArray());
return actualWiql;
}
示例5: GetResource
public object GetResource(IQueryable query, string fullTypeName)
{
object obj;
TraceHelper.Current.MethodCall2("DataServiceUpdateProvider", "GetResource", query.ToString(), fullTypeName);
try
{
DSLinqQueryProvider provider = query.Provider as DSLinqQueryProvider;
ExceptionHelpers.ThrowArgumentExceptionIf("query", provider == null, Resources.QueryDoesNotIncludePswsProvider, new object[0]);
if (!provider.IsFilterOverResourceRoot(query.Expression))
{
ReferredResourceExtractor referredResourceExtractor = new ReferredResourceExtractor();
DSResource current = null;
if (!referredResourceExtractor.Extract(query.Expression, provider.GetInitialQueryable(), provider.GetInitialResourceType(), provider.GetEntityMetadata(provider.GetInitialResourceType())))
{
IEnumerator<DSResource> enumerator = (query.GetEnumerator() as IEnumerable<DSResource>).GetEnumerator();
if (enumerator.MoveNext())
{
current = enumerator.Current;
if (enumerator.MoveNext())
{
throw new ArgumentException("multiple instances");
}
}
else
{
throw new ArgumentException("no instances");
}
}
else
{
current = referredResourceExtractor.ReferredResource;
}
ResourceType resourceType = current.ResourceType;
EntityMetadata entityMetadata = provider.GetEntityMetadata(resourceType);
IUpdateInstance referredEntityInstance = new ReferredEntityInstance(current, this.dataContext.UserContext, resourceType, entityMetadata, this.dataContext.MembershipId);
this.instances.Add(referredEntityInstance);
obj = referredEntityInstance;
}
else
{
ResourceType initialResourceType = provider.GetInitialResourceType();
EntityMetadata entityMetadatum = provider.GetEntityMetadata(initialResourceType);
this.entityInstance = new EntityUpdate(CommandType.Update, this.dataContext.UserContext, initialResourceType, entityMetadatum, query, this.dataContext.MembershipId);
this.instances.Add(this.entityInstance);
obj = this.entityInstance;
}
}
catch (ArgumentException argumentException1)
{
ArgumentException argumentException = argumentException1;
TraceHelper.Current.InvalidUpdateQuery(fullTypeName, query.ToString(), argumentException.GetType().ToString(), argumentException.Message);
obj = null;
}
return obj;
}