本文整理汇总了C#中PrimitiveTypeKind.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveTypeKind.ToString方法的具体用法?C# PrimitiveTypeKind.ToString怎么用?C# PrimitiveTypeKind.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrimitiveTypeKind
的用法示例。
在下文中一共展示了PrimitiveTypeKind.ToString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FixupModifiedDates
/// <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);
}
}
}
示例2: VerifySpatialEntityProperty
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());
}
示例3: GetDbType
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);
}
}
示例4: UpdateValue
/// <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);
}
}