Class ImportExportFacility
- Namespace
- ArcanaDevelopment.adTempus.Client
- Assembly
- ArcanaDevelopment.adTempus.Client.dll
Provides import and export facilities.
public sealed class ImportExportFacility
- Inheritance
-
objectImportExportFacility
Remarks
To create an ImportExportFacility, use GetImportExportFacility()
Note
Only one ImportExportFacility should be active within a Scheduler session, because each call to SetSource... will destroy the cached data on the server for any other export or import operations that are in progress.
Importing Data
Importing data requires these steps:
Properties
DataContext
The DataContext this object belongs to.
public DataContext DataContext { get; }
Property Value
Messages
Gets messages returned by the most recent operation.
public MessageCollection Messages { get; }
Property Value
ObjectComparisonReports
Gets the ObjectComparison reports returned by ImportData if the ReturnComparisonReport is specified.
public ReadOnlyCollection<ObjectComparison> ObjectComparisonReports { get; }
Property Value
- ReadOnlyCollection<ObjectComparison>
Remarks
This member will be null if ReturnComparisonReport is not specified, or if errors occur during import.
The ObjectComparisonReportGenerator can be used to create a report based on the ObjectComparisons.
Methods
ExportData(ExportOptions, out string)
Exports data to an XML document and returns the document.
public bool ExportData(ExportOptions options, out string exportedData)
Parameters
| Name | Type | Description |
|---|---|---|
options |
ExportOptions | Options controlling the export behavior |
exportedData |
string | Returns the export data, or null if an error occurs |
Returns
- bool
Remarks
This method returns the entire export document in memory. For large amounts of data, use ExportDataToFile or ExportDataToStream instead.
This method cannot be used if ExportOptions.CompressExport is true. Use ExportDataToFile or ExportDataToStream instead.
ExportDataToFile(ExportOptions, string)
Exports data and writes the results directly to a local file.
public bool ExportDataToFile(ExportOptions options, string targetFileName)
Parameters
| Name | Type | Description |
|---|---|---|
options |
ExportOptions | Options controlling the export behavior |
targetFileName |
string | The name of the file to write the data to. This file will be created locally (on the client computer), not on the server. |
Returns
- bool
ExportDataToStream(ExportOptions, Stream)
Exports data and writes the results to a stream.
public bool ExportDataToStream(ExportOptions options, Stream targetStream)
Parameters
| Name | Type | Description |
|---|---|---|
options |
ExportOptions | Options controlling the export behavior |
targetStream |
Stream | The stream to write the data to |
Returns
- bool
ImportData(ImportOptions, out ReadOnlyCollection<ImportedObject>)
Performs the import.
public ImportResult ImportData(ImportOptions options, out ReadOnlyCollection<ImportedObject> importedObjects)
Parameters
| Name | Type | Description |
|---|---|---|
options |
ImportOptions | Options to control the import process. |
importedObjects |
ReadOnlyCollection<ImportedObject> | A collection of ImportedObject objects with information about each object imported from the source. |
Returns
- ImportResult
An ImportResult giving the overall result of the operation. Refer to the ImportResult for individual items in the importedObjects collection for information about the state of each object.
Remarks
You must set the import source using one of the SetSource... methods before calling ImportData.
Calling ParseImportData before importing is optional, but you must either set ImportOptions.ImportSelectionsOnly=false or include ObjectImportParameters for each object you want to import, to tell adTempus which objects to import.
If ImportOptions.ReturnComparisonReport is True, the ObjectComparisonReports collection will be set after a successful import.
ParseImportData(ImportOptions, out ImportFileInformation)
Parses the import source and returns information about its contents.
public bool ParseImportData(ImportOptions options, out ImportFileInformation fileInformation)
Parameters
| Name | Type | Description |
|---|---|---|
options |
ImportOptions | Options to control the parsing and import process. |
fileInformation |
ImportFileInformation | On return, contains information about the import source and its contents. |
Returns
- bool
True if parsing was successful, or False if errors were found. Refer to the Messages collection for error information if the method returns False.
Remarks
Use this method to get information about the objects in the import source, which can then be used to set options for each object before performing the import using ImportData.
Calling ParseImportData is optional. See Remarks in ImportData(ImportOptions, out ReadOnlyCollection<ImportedObject>).
SetSource(string)
Sets the import source from a string.
public void SetSource(string data)
Parameters
| Name | Type | Description |
|---|---|---|
data |
string | The contents of an adTempus export file. |
SetSourceFromFile(string)
Sets the import source from a local file.
public void SetSourceFromFile(string fileName)
Parameters
| Name | Type | Description |
|---|---|---|
fileName |
string | The name of the file to use. |
Remarks
This is the name of a file on the client. The contents of the file are streamed to the server.
SetSourceFromSnapshot(ObjectChangeLog)
Sets the source from an object snapshot.
public void SetSourceFromSnapshot(ObjectChangeLog source)
Parameters
| Name | Type | Description |
|---|---|---|
source |
ObjectChangeLog | The ObjectChangeLog representing the snapshot to use. |
SetSourceFromStream(Stream)
Streams data to the server and sets the fileID to use to reference the data in subsequent calls.
public void SetSourceFromStream(Stream data)
Parameters
| Name | Type | Description |
|---|---|---|
data |
Stream | Stream containing the source data |