Beispiel #1
0
        private static void ExportObject(IPackageProvider s, IPersistenceObject obj, string[] propNamespaces)
        {
            XmlWriter writer = s.Writer;
            Type      t      = obj.ReadOnlyContext.GetInterfaceType(obj).Type;

            writer.WriteStartElement(t.Name, t.Namespace);
            if (((IExportable)obj).ExportGuid == Guid.Empty)
            {
                throw new InvalidOperationException(string.Format("At least one object of type {0} has an empty ExportGuid (ID={1})", t.FullName, obj.ID));
            }
            ((IExportableInternal)obj).Export(writer, propNamespaces);

            if (obj is Blob && s.SupportsBlobs)
            {
                var blob = (Blob)obj;
                s.PutBlob(blob.ExportGuid, blob.OriginalName, blob.GetStream());
            }
            writer.WriteEndElement();
        }
Beispiel #2
0
        private static void ExportObject(IPackageProvider s, IPersistenceObject obj, string[] propNamespaces)
        {
            XmlWriter writer = s.Writer;
            Type t = obj.ReadOnlyContext.GetInterfaceType(obj).Type;
            writer.WriteStartElement(t.Name, t.Namespace);
            if (((IExportable)obj).ExportGuid == Guid.Empty)
            {
                throw new InvalidOperationException(string.Format("At least one object of type {0} has an empty ExportGuid (ID={1})", t.FullName, obj.ID));
            }
            ((IExportableInternal)obj).Export(writer, propNamespaces);

            if (obj is Blob && s.SupportsBlobs)
            {
                var blob = (Blob)obj;
                s.PutBlob(blob.ExportGuid, blob.OriginalName, blob.GetStream());
            }
            writer.WriteEndElement();
        }