C# Class FdoToolbox.Core.Utility.ExpressUtility

Utility class for common FDO tasks and functionality
Exibir arquivo Open project: jumpinjackie/fdotoolbox Class Usage Examples

Public Methods

Method Description
ConvertFromNameValueCollection ( NameValueCollection nameValueCollection ) : string

Converts a NameValueCollection to a connection string style string

ConvertFromString ( string str ) : NameValueCollection

Converts a specially formatted string to a NameValueCollection

CopyAllSpatialContexts ( FdoConnection source, FdoConnection target, bool overwrite ) : void

Copies all spatial contexts from one connection to another. If the target connection only supports one spatial context, then the active spatial context is copied across.

CopyAllSpatialContexts ( ICollection spatialContexts, FdoConnection target, bool overwrite ) : void

Copies all spatial contexts from one connection to another. If the target connection only supports one spatial context, then the active spatial context is copied across.

CreateBulkCopy ( FdoConnection sourceConn, FdoConnection targetConn, string srcSchemaName, FeatureQueryOptions srcQuery, string targetSchemaName, string targetClassName, NameValueCollection propertyMapping ) : FdoBulkCopy

Utility method to create a bulk copy operation from one class to another

CreateBulkCopy ( FdoConnection source, string schemaName, string className, string provider, string savePath ) : FdoBulkCopy

Utility method to create a feature class dump bulk copy

CreateBulkCopy ( string sourceFile, string targetPath, bool copySpatialContexts, bool fixIncompatibleSchema, bool flattenGeometries ) : FdoBulkCopy

Creates a FDO bulk copy task. The target file will be created as part of this method call. If the target path is a directory, it is assumed that SHP files are to be created and copied to.

CreateFlatFileConnection ( string sourceFile ) : FdoConnection

Creates a connection to a FDO provider. The FDO provider must be a flat-file provider.

CreateFlatFileConnection ( string provider, string file ) : FdoConnection

Creates a connection to a FDO provider. The FDO provider must be a flat-file provider.

CreateFlatFileDataSource ( string file ) : bool

Creates a FDO data source. The provider must be a flat-file provider

CreateFlatFileDataSource ( string file, bool deleteIfExists ) : bool

Creates a FDO data source. The provider must be a flat-file provider

CreateFlatFileDataSource ( string provider, string path ) : bool

Creates a FDO data source. The provider must be a flat-file provider

CreateFlatFileDataSource ( string provider, string path, bool deleteIfExists ) : bool

Creates a FDO data source. The provider must be a flat-file provider

GetClassNames ( string sourceFile ) : string[]

Gets all class names from the specified flat-file data source

GetClrTypeFromFdoDataType ( DataType dt ) : Type

Gets the CLR type from a FDO data type

GetDataColumnForProperty ( DataPropertyDefinition dp ) : DataColumn

Converts a DataPropertyDefinition into a DataColumn

GetDataPropertyForColumn ( DataColumn col ) : DataPropertyDefinition

Converts a DataColumn object into a DataPropertyDefinition

GetFdoDataTypeFromClrType ( Type t ) : DataType

Gets the FDO data type for a CLR type

GetRelatedFiles ( string shapeFile ) : string[]

Gets the related files of a Shape File

HasRaster ( ClassDefinition cls ) : bool

Determines whether the specified class has a raster property.

IsShp ( string targetPath ) : bool

Determines whether the specified target path is a valid SHP provider file path

Private Methods

Method Description
GetFileParameter ( string provider ) : string
GetProviderFromFileExtension ( string path ) : string

Infers the FDO provider name from the file's extension

Method Details

ConvertFromNameValueCollection() public static method

Converts a NameValueCollection to a connection string style string
public static ConvertFromNameValueCollection ( NameValueCollection nameValueCollection ) : string
nameValueCollection System.Collections.Specialized.NameValueCollection
return string

ConvertFromString() public static method

Converts a specially formatted string to a NameValueCollection
public static ConvertFromString ( string str ) : NameValueCollection
str string
return System.Collections.Specialized.NameValueCollection

CopyAllSpatialContexts() public static method

Copies all spatial contexts from one connection to another. If the target connection only supports one spatial context, then the active spatial context is copied across.
public static CopyAllSpatialContexts ( FdoConnection source, FdoConnection target, bool overwrite ) : void
source FdoToolbox.Core.Feature.FdoConnection The source connection
target FdoToolbox.Core.Feature.FdoConnection The target connection
overwrite bool If true will overwrite any existing spatial contexts, otherwise it will add them. This value is ignored if the target connection does not support multiple spatial contexts
return void

CopyAllSpatialContexts() public static method

Copies all spatial contexts from one connection to another. If the target connection only supports one spatial context, then the active spatial context is copied across.
public static CopyAllSpatialContexts ( ICollection spatialContexts, FdoConnection target, bool overwrite ) : void
spatialContexts ICollection The spatial contexts.
target FdoToolbox.Core.Feature.FdoConnection The target.
overwrite bool if set to true [overwrite].
return void

CreateBulkCopy() public static method

Utility method to create a bulk copy operation from one class to another
public static CreateBulkCopy ( FdoConnection sourceConn, FdoConnection targetConn, string srcSchemaName, FeatureQueryOptions srcQuery, string targetSchemaName, string targetClassName, NameValueCollection propertyMapping ) : FdoBulkCopy
sourceConn FdoToolbox.Core.Feature.FdoConnection
targetConn FdoToolbox.Core.Feature.FdoConnection
srcSchemaName string
srcQuery FdoToolbox.Core.Feature.FeatureQueryOptions
targetSchemaName string
targetClassName string
propertyMapping System.Collections.Specialized.NameValueCollection
return FdoToolbox.Core.ETL.Specialized.FdoBulkCopy

CreateBulkCopy() public static method

Utility method to create a feature class dump bulk copy
public static CreateBulkCopy ( FdoConnection source, string schemaName, string className, string provider, string savePath ) : FdoBulkCopy
source FdoToolbox.Core.Feature.FdoConnection
schemaName string
className string
provider string
savePath string
return FdoToolbox.Core.ETL.Specialized.FdoBulkCopy

CreateBulkCopy() public static method

Creates a FDO bulk copy task. The target file will be created as part of this method call. If the target path is a directory, it is assumed that SHP files are to be created and copied to.
public static CreateBulkCopy ( string sourceFile, string targetPath, bool copySpatialContexts, bool fixIncompatibleSchema, bool flattenGeometries ) : FdoBulkCopy
sourceFile string The path to the source file.
targetPath string /// The path to the target file/directory. If it is a directory, it is assumed /// that SHP files are to be created and copied to. ///
copySpatialContexts bool If true, will also copy spatial contexts
fixIncompatibleSchema bool If true, will try to fix the source schema to make it compatible with the target connection. If false, an exception will be thrown
flattenGeometries bool If true, will strip all Z and M coordinates from all geometries that are copied
return FdoToolbox.Core.ETL.Specialized.FdoBulkCopy

CreateFlatFileConnection() public static method

Creates a connection to a FDO provider. The FDO provider must be a flat-file provider.
public static CreateFlatFileConnection ( string sourceFile ) : FdoConnection
sourceFile string
return FdoToolbox.Core.Feature.FdoConnection

CreateFlatFileConnection() public static method

Creates a connection to a FDO provider. The FDO provider must be a flat-file provider.
public static CreateFlatFileConnection ( string provider, string file ) : FdoConnection
provider string
file string
return FdoToolbox.Core.Feature.FdoConnection

CreateFlatFileDataSource() public static method

Creates a FDO data source. The provider must be a flat-file provider
public static CreateFlatFileDataSource ( string file ) : bool
file string The file.
return bool

CreateFlatFileDataSource() public static method

Creates a FDO data source. The provider must be a flat-file provider
public static CreateFlatFileDataSource ( string file, bool deleteIfExists ) : bool
file string The file
deleteIfExists bool if set to true will delete the file if it already exists.
return bool

CreateFlatFileDataSource() public static method

Creates a FDO data source. The provider must be a flat-file provider
public static CreateFlatFileDataSource ( string provider, string path ) : bool
provider string The provider.
path string The path.
return bool

CreateFlatFileDataSource() public static method

Creates a FDO data source. The provider must be a flat-file provider
public static CreateFlatFileDataSource ( string provider, string path, bool deleteIfExists ) : bool
provider string The provider.
path string The path.
deleteIfExists bool if set to true deletes the specified file if it exists.
return bool

GetClassNames() public static method

Gets all class names from the specified flat-file data source
public static GetClassNames ( string sourceFile ) : string[]
sourceFile string
return string[]

GetClrTypeFromFdoDataType() public static method

Gets the CLR type from a FDO data type
public static GetClrTypeFromFdoDataType ( DataType dt ) : Type
dt DataType
return System.Type

GetDataColumnForProperty() public static method

Converts a DataPropertyDefinition into a DataColumn
public static GetDataColumnForProperty ( DataPropertyDefinition dp ) : DataColumn
dp DataPropertyDefinition The data property definition
return System.Data.DataColumn

GetDataPropertyForColumn() public static method

Converts a DataColumn object into a DataPropertyDefinition
public static GetDataPropertyForColumn ( DataColumn col ) : DataPropertyDefinition
col System.Data.DataColumn The data column
return DataPropertyDefinition

GetFdoDataTypeFromClrType() public static method

Gets the FDO data type for a CLR type
public static GetFdoDataTypeFromClrType ( Type t ) : DataType
t System.Type
return DataType

GetRelatedFiles() public static method

Gets the related files of a Shape File
public static GetRelatedFiles ( string shapeFile ) : string[]
shapeFile string The shape file.
return string[]

HasRaster() public static method

Determines whether the specified class has a raster property.
public static HasRaster ( ClassDefinition cls ) : bool
cls ClassDefinition The class
return bool

IsShp() public static method

Determines whether the specified target path is a valid SHP provider file path
public static IsShp ( string targetPath ) : bool
targetPath string The target path.
return bool