本文整理汇总了C#中IZetboxContext.Internals方法的典型用法代码示例。如果您正苦于以下问题:C# IZetboxContext.Internals方法的具体用法?C# IZetboxContext.Internals怎么用?C# IZetboxContext.Internals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IZetboxContext
的用法示例。
在下文中一共展示了IZetboxContext.Internals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportElement
private static IPersistenceObject ImportElement(IZetboxContext ctx, Dictionary<Guid, IPersistenceObject> objects, IPackageProvider s)
{
Guid exportGuid = s.Reader.GetAttribute("ExportGuid").TryParseGuidValue();
if (exportGuid != Guid.Empty)
{
string ifTypeName = string.Format("{0}.{1}", s.Reader.NamespaceURI, s.Reader.LocalName);
ifTypeName = MigrateTypeNameMapping(ifTypeName);
InterfaceType ifType = ctx.GetInterfaceType(ifTypeName);
if (ifType.Type == null)
{
Log.WarnOnce(string.Format("Type {0} not found", ifTypeName));
return null;
}
IPersistenceObject obj = FindObject(ctx, objects, exportGuid, ifType);
using (var children = s.Reader.ReadSubtree())
{
while (children.Read())
{
if (children.NodeType == XmlNodeType.Element)
{
((IExportableInternal)obj).MergeImport(s.Reader);
}
}
}
if (obj is Blob && s.SupportsBlobs)
{
var blob = (Blob)obj;
using (var stream = s.GetBlob(blob.ExportGuid))
{
blob.StoragePath = ctx.Internals().StoreBlobStream(stream, blob.ExportGuid, blob.CreatedOn, blob.OriginalName);
}
}
return obj;
}
else
{
return null;
}
}
示例2: ReadObjects
private List<IPersistenceObject> ReadObjects(Stream msg, IZetboxContext ctx)
{
var objects = new List<IPersistenceObject>();
var sr = _readerFactory.Invoke(new BinaryReader(msg));
while (sr.ReadBoolean())
{
// Deserialize
var objType = sr.ReadSerializableType();
var obj = ctx.Internals().CreateUnattached(_iftFactory(objType.GetSystemType()));
obj.FromStream(sr);
objects.Add(obj);
}
return objects;
}
示例3: FindObject
private static IPersistenceObject FindObject(IZetboxContext ctx, Dictionary<Guid, IPersistenceObject> objects, Guid exportGuid, InterfaceType ifType)
{
if (!objects.ContainsKey(exportGuid))
{
if (!ifType.Type.IsIDataObject() &&
!ifType.Type.IsIRelationEntry())
{
throw new NotSupportedException(String.Format("Interfacetype {0} is not supported", ifType));
}
IPersistenceObject obj = ctx.Internals().CreateUnattached(ifType);
objects[exportGuid] = obj;
((Zetbox.App.Base.IExportable)obj).ExportGuid = exportGuid;
ctx.Internals().AttachAsNew(obj);
return obj;
}
else
{
return objects[exportGuid];
}
}