本文整理汇总了C#中IZetboxContext.FindPersistenceObjects方法的典型用法代码示例。如果您正苦于以下问题:C# IZetboxContext.FindPersistenceObjects方法的具体用法?C# IZetboxContext.FindPersistenceObjects怎么用?C# IZetboxContext.FindPersistenceObjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IZetboxContext
的用法示例。
在下文中一共展示了IZetboxContext.FindPersistenceObjects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: should_return_all_objects
public void should_return_all_objects()
{
ctx = GetContext();
var foundGuids = ctx.FindPersistenceObjects<ObjectClass>(guids).ToList().Select(cls => cls.ExportGuid);
Assert.That(foundGuids, Is.EquivalentTo(guids));
}
示例2: should_not_return_nulls
public void should_not_return_nulls()
{
var lookupGuids = guids.Concat(new[] { Guid.Empty }); // add illegal value
ctx = GetContext();
var foundObjs = ctx.FindPersistenceObjects<ObjectClass>(lookupGuids).ToList();
Assert.That(foundObjs, Has.No.Member(null), "FindPersistenceObjects returned a null entry");
var foundGuids = foundObjs.Select(cls => cls.ExportGuid);
Assert.That(foundGuids, Is.EquivalentTo(guids));
}
示例3: PreFetchObjects
private static void PreFetchObjects(IZetboxContext ctx, Dictionary<Guid, IPersistenceObject> objects, Dictionary<Type, List<Guid>> guids)
{
Log.Info("Prefetching Objects");
foreach (Type t in guids.Keys)
{
IEnumerable<IPersistenceObject> result = ctx.FindPersistenceObjects(ctx.GetInterfaceType(t), guids[t]);
if (Log.IsDebugEnabled)
{
// avoid result.Count() evaluation if not needed
Log.DebugFormat("{0}: XML: {1}, Storage: {2}", t.FullName, guids[t].Count, result.Count());
}
foreach (IPersistenceObject obj in result)
{
objects.Add(((IExportableInternal)obj).ExportGuid, obj);
}
}
}