/// <summary> /// Used during save to upated created / modified dates /// </summary> /// <param name="stateEntryEntity">State entry to update</param> /// <param name="columnNameLike">what the column name should contain</param> /// <param name="typeToUpdateFor">The datatype to update</param> /// <param name="value">The value to update to</param> internal static void UpdateValue(ObjectStateEntry stateEntryEntity, string columnNameLike, PrimitiveTypeKind typeToUpdateFor, object value) { var createdProps = stateEntryEntity.CurrentValues.DataRecordInfo.FieldMetadata.Where( meta => meta.FieldType.Name.ToLower().Contains(columnNameLike.ToLower())); foreach (var eachProp in createdProps) { if (eachProp.FieldType.TypeUsage.EdmType.Name == typeToUpdateFor.ToString()) { stateEntryEntity.CurrentValues.SetValue(eachProp.Ordinal, value); } } }
/// <summary> /// 动态设置实体字段的值 /// </summary> /// <param name="entry">ObjectStateEntry 实体封装对象</param> /// <param name="osm">对象缓冲</param> /// <param name="FieldName">字段名</param> /// <param name="EDMType">字段类型</param> /// <param name="Value">字段值</param> internal static void FixupModifiedDates(this ObjectStateEntry entry, ObjectStateManager osm, string FieldName, PrimitiveTypeKind EDMType, object Value) { var fieldMetaData = entry.CurrentValues.DataRecordInfo.FieldMetadata; FieldMetadata modifiedField = fieldMetaData .Where(f => f.FieldType.Name == FieldName) .FirstOrDefault(); if (modifiedField.FieldType != null) { string fieldTypeName = modifiedField.FieldType.TypeUsage.EdmType.Name; if (fieldTypeName == EDMType.ToString()) { entry.CurrentValues.SetValue(modifiedField.Ordinal, Value); } } }
internal static DbType GetDbType(PrimitiveTypeKind primitiveType) { switch (primitiveType) { case PrimitiveTypeKind.Binary: return(DbType.Binary); case PrimitiveTypeKind.Boolean: return(DbType.Boolean); case PrimitiveTypeKind.Byte: return(DbType.Byte); case PrimitiveTypeKind.DateTime: return(DbType.DateTime); case PrimitiveTypeKind.Decimal: return(DbType.Decimal); case PrimitiveTypeKind.Double: return(DbType.Double); case PrimitiveTypeKind.Single: return(DbType.Single); case PrimitiveTypeKind.Guid: return(DbType.Guid); case PrimitiveTypeKind.Int16: return(DbType.Int16); case PrimitiveTypeKind.Int32: return(DbType.Int32); case PrimitiveTypeKind.Int64: return(DbType.Int64); case PrimitiveTypeKind.String: return(DbType.String); default: Debug.Fail("unknown PrimitiveTypeKind" + primitiveType.ToString()); throw ADP1.InvalidOperation(String.Empty); } }
internal static DbType GetDbType(PrimitiveTypeKind primitiveType) { switch (primitiveType) { case PrimitiveTypeKind.Binary: return(DbType.Binary); case PrimitiveTypeKind.Boolean: return(DbType.Boolean); case PrimitiveTypeKind.Byte: return(DbType.Byte); case PrimitiveTypeKind.DateTime: return(DbType.DateTime); case PrimitiveTypeKind.Decimal: return(DbType.Decimal); case PrimitiveTypeKind.Double: return(DbType.Double); case PrimitiveTypeKind.Single: return(DbType.Single); case PrimitiveTypeKind.Guid: return(DbType.Guid); case PrimitiveTypeKind.Int16: return(DbType.Int16); case PrimitiveTypeKind.Int32: return(DbType.Int32); case PrimitiveTypeKind.Int64: return(DbType.Int64); //case PrimitiveTypeKind.Money: return DbType.Decimal; case PrimitiveTypeKind.SByte: return(DbType.SByte); case PrimitiveTypeKind.String: return(DbType.String); //case PrimitiveTypeKind.UInt16: return DbType.UInt16; //case PrimitiveTypeKind.UInt32: return DbType.UInt32; //case PrimitiveTypeKind.UInt64: return DbType.UInt64; //case PrimitiveTypeKind.Xml: return DbType.Xml; case PrimitiveTypeKind.Geography: case PrimitiveTypeKind.Geometry: return(DbType.Object); default: Debug.Fail("unknown PrimitiveTypeKind" + primitiveType.ToString()); throw new InvalidOperationException(string.Format("Unknown PrimitiveTypeKind {0}", primitiveType)); } }
public JavaClass GetBoxClass() { string myName; switch (_kind) { case PrimitiveTypeKind.Int: myName = "Integer"; break; case PrimitiveTypeKind.Char: myName = "Character"; break; default: myName = _kind.ToString(); break; } return(new JavaClass(_vm, "java.lang." + myName)); }
internal static IngresType GetIngresType(PrimitiveTypeKind primitiveType) { switch (primitiveType) { case PrimitiveTypeKind.Binary: return(IngresType.VarBinary); case PrimitiveTypeKind.Boolean: return(IngresType.TinyInt); case PrimitiveTypeKind.Byte: return(IngresType.SmallInt); case PrimitiveTypeKind.DateTime: return(IngresType.DateTime); case PrimitiveTypeKind.Decimal: return(IngresType.Decimal); case PrimitiveTypeKind.Double: return(IngresType.Double); case PrimitiveTypeKind.Guid: throw new InvalidOperationException("PrimitiveTypeKind Guid is not supported"); case PrimitiveTypeKind.Single: return(IngresType.Real); case PrimitiveTypeKind.SByte: return(IngresType.TinyInt); case PrimitiveTypeKind.Int16: return(IngresType.SmallInt); case PrimitiveTypeKind.Int32: return(IngresType.Int); case PrimitiveTypeKind.Int64: return(IngresType.BigInt); case PrimitiveTypeKind.String: return(IngresType.VarChar); case PrimitiveTypeKind.Time: return(IngresType.Time); case PrimitiveTypeKind.DateTimeOffset: throw new InvalidOperationException("PrimitiveTypeKind DateTimeOffset is not supported"); default: Debug.Fail("unknown PrimitiveTypeKind" + primitiveType.ToString()); throw new InvalidOperationException(string.Format("Unknown PrimitiveTypeKind {0}", primitiveType)); } }
private void VerifySpatialEntityProperty(PrimitiveTypeKind spatialType) { EdmItemCollection items = SpatialEntityPropertyTest(EdmNamespaceV3, spatialType, "ID", UseStrongSpatialAnnotation); EntityType spatialEntityType = items.GetItem<EntityType>("SpatialEntityPropertyTest.EntityWithSpatialProperty", ignoreCase: false); EdmProperty spatialProperty = spatialEntityType.Properties["Location"]; PrimitiveType primitivePropertyType = (PrimitiveType)spatialProperty.TypeUsage.EdmType; Assert.True(primitivePropertyType.PrimitiveTypeKind == spatialType, "Spatial Entity property was not correctly loaded for " + spatialType.ToString()); }
internal static DbType GetDbType(PrimitiveTypeKind primitiveType) { switch (primitiveType) { case PrimitiveTypeKind.Binary: return DbType.Binary; case PrimitiveTypeKind.Boolean: return DbType.Boolean; case PrimitiveTypeKind.Byte: return DbType.Byte; case PrimitiveTypeKind.DateTime: return DbType.DateTime; case PrimitiveTypeKind.Decimal: return DbType.Decimal; case PrimitiveTypeKind.Double: return DbType.Double; case PrimitiveTypeKind.Single: return DbType.Single; case PrimitiveTypeKind.Guid: return DbType.Guid; case PrimitiveTypeKind.Int16: return DbType.Int16; case PrimitiveTypeKind.Int32: return DbType.Int32; case PrimitiveTypeKind.Int64: return DbType.Int64; case PrimitiveTypeKind.String: return DbType.String; default: Debug.Fail("unknown PrimitiveTypeKind" + primitiveType.ToString()); throw ADP1.InvalidOperation(String.Empty); } }
private void VerifySpatialEntityProperty(PrimitiveTypeKind spatialType) { EdmItemCollection items = SpatialEntityPropertyTest(EdmNamespaceV3, spatialType, "ID", UseStrongSpatialAnnotation); EntityType spatialEntityType = items.GetItem <EntityType>("SpatialEntityPropertyTest.EntityWithSpatialProperty", ignoreCase: false); EdmProperty spatialProperty = spatialEntityType.Properties["Location"]; PrimitiveType primitivePropertyType = (PrimitiveType)spatialProperty.TypeUsage.EdmType; Assert.True(primitivePropertyType.PrimitiveTypeKind == spatialType, "Spatial Entity property was not correctly loaded for " + spatialType.ToString()); }
/// <summary> /// Used during save to upated created / modified dates /// </summary> /// <param name="stateEntryEntity">State entry to update</param> /// <param name="columnNameLike">what the column name should contain</param> /// <param name="typeToUpdateFor">The datatype to update</param> /// <param name="value">The value to update to</param> internal static void UpdateValue(ObjectStateEntry stateEntryEntity, string columnNameLike, PrimitiveTypeKind typeToUpdateFor, object value) { var createdProps = stateEntryEntity.CurrentValues.DataRecordInfo.FieldMetadata.Where( meta => meta.FieldType.Name.ToLower().Contains(columnNameLike.ToLower())); foreach (var eachProp in createdProps) { if (eachProp.FieldType.TypeUsage.EdmType.Name == typeToUpdateFor.ToString()) stateEntryEntity.CurrentValues.SetValue(eachProp.Ordinal, value); } }