当前位置: 首页>>代码示例>>C#>>正文


C# PrimitiveTypeKind.ToString方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:zlphoenix,项目名称:MyDemos,代码行数:23,代码来源:EntityObjectExtensions.cs

示例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());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:9,代码来源:MetadataSpatialTests.cs

示例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);
     }
 }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:33,代码来源:TypeSemantics.cs

示例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);
            }
        }
开发者ID:BostonSymphOrch,项目名称:HENRY-archives,代码行数:18,代码来源:BsoArchiveEntities.cs


注:本文中的PrimitiveTypeKind.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。