C# Class FdoToolbox.Core.Feature.ValueConverter

Utility class to perform conversion to/from/between FDO and CLR data types
Mostrar archivo Open project: jumpinjackie/fdotoolbox

Public Methods

Method Description
ConvertDataValue ( DataValue src, DataType dataType ) : DataValue

Converts a source DataValue to a DataValue of the given type. Incompatible values are converted to null and values outside the valid range are truncated

ConvertDataValue ( DataValue src, DataType dataType, bool nullIfIncompatible, bool truncate ) : DataValue

Converts a source DataValue to a DataValue of the given type

FromDataType ( DataType dt ) : FdoPropertyType

Converts a FDO data type to a FDO property type

GetClrValue ( DataValue val ) : object

Gets the CLR value.

GetConvertedValue ( object value ) : LiteralValue

Gets a FDO literal value type from a CLR type

GetDataType ( FdoPropertyType pt ) : DataType?

Gets the data type

GetPropertyType ( DataType dt ) : FdoPropertyType

Gets the property type

IsConvertible ( DataType src, DataType dest ) : bool

Determines if one data type can be converted to another

Private Methods

Method Description
ConvertBoolean ( BooleanValue src, DataType dataType ) : DataValue
ConvertByte ( ByteValue src, DataType dataType ) : DataValue
ConvertDateTime ( DateTimeValue src, DataType dataType ) : DataValue
ConvertDecimal ( DecimalValue src, DataType dataType, bool truncate ) : DataValue
ConvertDouble ( DoubleValue doubleValue, DataType dataType, bool truncate ) : DataValue
ConvertInt16 ( Int16Value int16Value, DataType dataType, bool truncate ) : DataValue
ConvertInt32 ( Int32Value int32Value, DataType dataType, bool truncate ) : DataValue
ConvertInt64 ( Int64Value int64Value, DataType dataType, bool truncate ) : DataValue
ConvertSingle ( SingleValue singleValue, DataType dataType, bool truncate ) : DataValue
ConvertString ( StringValue stringValue, DataType dataType, bool truncate ) : DataValue

Method Details

ConvertDataValue() public static method

Converts a source DataValue to a DataValue of the given type. Incompatible values are converted to null and values outside the valid range are truncated
public static ConvertDataValue ( DataValue src, DataType dataType ) : DataValue
src DataValue The source data value
dataType DataType The data type to convert to
return DataValue

ConvertDataValue() public static method

Converts a source DataValue to a DataValue of the given type
public static ConvertDataValue ( DataValue src, DataType dataType, bool nullIfIncompatible, bool truncate ) : DataValue
src DataValue The source data value
dataType DataType The data type to convert to
nullIfIncompatible bool Determines what happens if the source and destination types are incompatible
truncate bool Determines what happens if the value is outside the valid range for the destination type (e.g. convert 1000000 from FdoInt32Value to FdoInt16Value). Applicable only when both source and destination types are one of Boolean, Byte, Decimal, Double, Int16, Int32, Int64 or Single
return DataValue

FromDataType() public static method

Converts a FDO data type to a FDO property type
public static FromDataType ( DataType dt ) : FdoPropertyType
dt DataType
return FdoPropertyType

GetClrValue() public static method

Gets the CLR value.
public static GetClrValue ( DataValue val ) : object
val DataValue The val.
return object

GetConvertedValue() public static method

Gets a FDO literal value type from a CLR type
public static GetConvertedValue ( object value ) : LiteralValue
value object
return LiteralValue

GetDataType() public static method

Gets the data type
public static GetDataType ( FdoPropertyType pt ) : DataType?
pt FdoPropertyType The
return DataType?

GetPropertyType() public static method

Gets the property type
public static GetPropertyType ( DataType dt ) : FdoPropertyType
dt DataType The data type
return FdoPropertyType

IsConvertible() public static method

Determines if one data type can be converted to another
public static IsConvertible ( DataType src, DataType dest ) : bool
src DataType The source data type
dest DataType The target data type
return bool