当前位置: 首页>>代码示例>>C#>>正文


C# IZetboxContext.Internals方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:43,代码来源:Importer.cs

示例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;
        }
开发者ID:daszat,项目名称:zetbox,代码行数:15,代码来源:ZetboxService.cs

示例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];
     }
 }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:20,代码来源:Importer.cs


注:本文中的IZetboxContext.Internals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。