分布式数据库复本变化信息的导出导入

1分布式数据库复本变化信息的导出

 public void ExportReplicaChange(IGeoDataServer iGDS,string rName)
       {
           IGDSExportOptions iExOptions = new GDSExportOptionsClass();
           iExOptions.ExportFormat = esriGDSExportFormat.esriGDSExportFormatXml;
           iExOptions.Compressed = true;
           esriGDSTransportType tType = esriGDSTransportType.esriGDSTransportTypeUrl;
           esriExportGenerationsOption gOption = esriExportGenerationsOption.esriExportGenerationsAll;
           IGDSData iGDSData = iGDS.ExportReplicaDataChanges(rName, iExOptions, tType, gOption,false);
           System.Net.WebClient wc = new System.Net.WebClient();
           wc.DownloadFile(iGDSData.URL, @"D:\delta.zip");
           wc.Dispose();
       } 

2分布式数据库复本变化信息的导入

/// <summary>
        /// 导入复本变化信息
        /// </summary>
        /// <param name="iGDS"></param>
        /// <param name="rName"></param>
        public void ImportRelicaChanges(IGeoDataServer iGDS, string rName)
        {
            string fName = "D:\\delta.zip";
            System.IO.FileInfo fInfo = new System.IO.FileInfo(fName);
            int len = (int)fInfo.Length;
            byte[] bytes = new byte[len];
            System.IO.FileStream fs = System.IO.File.Open(fName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
            System.IO.BinaryReader r = new System.IO.BinaryReader(fs);
            r.Read(bytes, 0, len);
            r.Close();
            fs.Close();

            IGDSData iGDSData = new GDSDataClass();
            iGDSData.TransportType = esriGDSTransportType.esriGDSTransportTypeEmbedded;
            iGDSData.set_EmbeddedData(ref bytes);
            esriGDSReplicaImportSource rSrc = esriGDSReplicaImportSource.esriGDSReplicaImportSourceDeltaXmlFile;
            esriReplicaReconcilePolicyType rPolicyType = esriReplicaReconcilePolicyType.esriReplicaDetectConflicts;
            bool confliets = iGDS.ImportReplicaDataChanges(rSrc, rPolicyType, true, iGDSData);

        }




你可能感兴趣的:(分布式数据库)