本文整理汇总了C#中SessionNoServer.LoadFields方法的典型用法代码示例。如果您正苦于以下问题:C# SessionNoServer.LoadFields方法的具体用法?C# SessionNoServer.LoadFields怎么用?C# SessionNoServer.LoadFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SessionNoServer
的用法示例。
在下文中一共展示了SessionNoServer.LoadFields方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static int Main(string[] args)
{
if (args.Length == 0)
{
System.Console.WriteLine("ERROR, no boot path specified. Restart Verify and add bootup database path as a command line parameter");
return 1;
}
int ct = 0;
try
{
using (SessionNoServer session = new SessionNoServer(args[0]))
{
DataCache.MaximumMemoryUse = 10000000000; // 10 GB, set this to what fits your case
session.BeginRead();
List<Database> dbList = session.OpenAllDatabases();
foreach (Database db in dbList)
foreach (Page page in db)
foreach (IOptimizedPersistable iPers in page)
{
object obj = iPers.WrappedObject;
++ct;
if (iPers.WrappedObject is IOptimizedPersistable)
{
UInt64 id = iPers.Id;
OptimizedPersistable pObj = iPers as OptimizedPersistable;
if (pObj != null)
{
session.LoadFields(pObj);
foreach (OptimizedPersistable fObj in pObj.OptimizedPersistableFieldValues())
{
session.LoadFields(fObj);
}
foreach (object value in pObj.GetFieldValues())
{
WeakIOptimizedPersistableReferenceBase weakRef = value as WeakIOptimizedPersistableReferenceBase;
if (weakRef != null)
if (session.Open(weakRef.Id) == null)
throw new UnexpectedException("WeakRefence object is null");
}
}
}
else if (obj is string)
continue;
else if (obj is Array)
continue;
IEnumerable anEnum = obj as IEnumerable;
if (anEnum != null)
foreach (object o in anEnum)
{
}
}
session.Commit();
}
Console.WriteLine("OK, verfied " + ct + " objects");
return 0;
}
catch (Exception ex)
{
Console.WriteLine("FAILED, verfied " + ct + " objects");
Console.WriteLine(ex.ToString());
return -1;
}
}