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


C# PrimitiveTypeKind类代码示例

本文整理汇总了C#中PrimitiveTypeKind的典型用法代码示例。如果您正苦于以下问题:C# PrimitiveTypeKind类的具体用法?C# PrimitiveTypeKind怎么用?C# PrimitiveTypeKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PrimitiveTypeKind类属于命名空间,在下文中一共展示了PrimitiveTypeKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: AddAggregate

        internal void AddAggregate(
            PrimitiveTypeKind returnTypeKind, string aggregateFunctionName, PrimitiveTypeKind collectionArgumentElementTypeKind)
        {
            DebugCheck.NotEmpty(aggregateFunctionName);

            var returnParameter = CreateReturnParameter(returnTypeKind);
            var collectionParameter = CreateAggregateParameter(collectionArgumentElementTypeKind);

            var function = new EdmFunction(
                aggregateFunctionName,
                EdmConstants.EdmNamespace,
                DataSpace.CSpace,
                new EdmFunctionPayload
                    {
                        IsAggregate = true,
                        IsBuiltIn = true,
                        ReturnParameters = new[] { returnParameter },
                        Parameters = new FunctionParameter[1] { collectionParameter },
                        IsFromProviderManifest = true,
                    });

            function.SetReadOnly();

            functions.Add(function);
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:25,代码来源:EdmProviderManifestFunctionBuilder.cs

示例3: CreateConstFacet

 private static Facet CreateConstFacet(string facetName, PrimitiveTypeKind facetTypeKind, object value)
 {
     return Facet.Create(
         new FacetDescription(
             facetName, PrimitiveType.GetEdmPrimitiveType(facetTypeKind),
             null, null, value, true, null), value);
 }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:StructuralTypeMappingGeneratorTests.cs

示例4: ColumnModel

 /// <summary>
 ///     Initializes a new instance of the  class.
 /// </summary>
 /// <param name = "type">The data type for this column.</param>
 /// <param name = "typeUsage">
 ///     Additional details about the data type.
 ///     This includes details such as maximum length, nullability etc.
 /// </param>
 public ColumnModel(PrimitiveTypeKind type, TypeUsage typeUsage)
 {
     _type = type;
     _typeUsage = typeUsage;
     _clrType = PrimitiveType.GetEdmPrimitiveType(_type).ClrEquivalentType;
     _clrDefaultValue = CreateDefaultValue();
 }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:15,代码来源:ColumnModel.cs

示例5: GetStorePrimitiveType

 /// <summary>
 ///     Translate a conceptual primitive type to an adequate store specific primitive type according to the
 ///     provider configuration of the model.
 /// </summary>
 /// <param name="model">A DbModel instance with provider information</param>
 /// <param name="typeKind">A PrimitiveTypeKind instance representing the conceptual primitive type to be translated</param>
 /// <returns>An EdmType instance representing the store primitive type</returns>
 public static EdmType GetStorePrimitiveType( this DbModel model, PrimitiveTypeKind typeKind )
 {
     return model
         .ProviderManifest
         .GetStoreType(
             TypeUsage.CreateDefaultTypeUsage(
                 PrimitiveType.GetEdmPrimitiveType( typeKind ) ) ).EdmType;
 }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:15,代码来源:DbMetadataExtensions.cs

示例6: IsPrimitiveType

 internal static bool IsPrimitiveType(TypeUsage type, PrimitiveTypeKind primitiveType)
 {
     PrimitiveTypeKind typeKind;
     if (TypeHelpers.TryGetPrimitiveTypeKind(type, out typeKind))
     {
         return (typeKind == primitiveType);
     }
     return false;
 }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:9,代码来源:TypeSemantics.cs

示例7: GetStoreTypeName

        public static string GetStoreTypeName(
            this DbProviderManifest providerManifest, PrimitiveTypeKind primitiveTypeKind)
        {
            Contract.Requires(providerManifest != null);

            var edmTypeUsage = TypeUsage.CreateDefaultTypeUsage(
                PrimitiveType.GetEdmPrimitiveType(primitiveTypeKind));

            return providerManifest.GetStoreType(edmTypeUsage).EdmType.Name;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:10,代码来源:DbProviderManifestExtensions.cs

示例8: Check_result_for_basic_type

            private static void Check_result_for_basic_type(PrimitiveTypeKind primitiveTypeKind, object defaultValue)
            {
                var primitiveType = PrimitiveType.GetEdmPrimitiveType(primitiveTypeKind);
                PropagatorResult result;

                Propagator.ExtentPlaceholderCreator.GetPropagatorResultForPrimitiveType(primitiveType, out result);

                Assert.NotNull(result);
                Assert.Equal(true, result.IsSimple);
                Assert.Equal(defaultValue, result.GetSimpleValue());
            }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:11,代码来源:PropagatorTests.cs

示例9: 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

示例10: GenerateCanOutputAddColumnStatement

        public void GenerateCanOutputAddColumnStatement(PrimitiveTypeKind type, string typeName)
        {
            var migrationSqlGenerator = new PostgreSqlMigrationSqlGenerator();

            var column = new ColumnModel(type)
            {
                Name = "Bar",
                IsIdentity = true
            };
            var addColumnOperation = new AddColumnOperation("Foo", column);

            var sql = migrationSqlGenerator.Generate(
                new[] { addColumnOperation }, "9.2").Join(s => s.Sql, Environment.NewLine);

            Assert.True(sql.Contains(string.Format("ALTER TABLE \"Foo\" ADD \"Bar\" {0}", typeName)));
        }
开发者ID:darionato,项目名称:PostgreSqlMigrationSqlGenerator,代码行数:16,代码来源:PostgreSqlMigrationSqlGeneretorTest.cs

示例11: HandlIdentity_adds_cast_for_identity_columns

        private static string HandlIdentity_adds_cast_for_identity_columns(PrimitiveTypeKind primitiveTypeKind)
        {
            var typeUsage = ProviderRegistry.SqlCe4_ProviderManifest.GetStoreType(
                TypeUsage.CreateDefaultTypeUsage(PrimitiveType.GetEdmPrimitiveType(primitiveTypeKind)));

            var mockMember = new Mock<EdmMember>();
            mockMember.Setup(m => m.TypeUsage).Returns(typeUsage);

            var mockTransalator = new Mock<DmlSqlGenerator.ExpressionTranslator>();
            mockTransalator.Setup(m => m.MemberValues).Returns(new Dictionary<EdmMember, DbParameter>());

            var builder = new SqlStringBuilder();
            DmlSqlGenerator.HandleIdentity(builder, mockTransalator.Object, mockMember.Object, false, new Mock<EntitySetBase>().Object);

            return builder.ToString();
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:16,代码来源:DmlSqlGeneratorTests.cs

示例12: Check_result_for_geometry_type

            private static void Check_result_for_geometry_type(PrimitiveTypeKind primitiveTypeKind, object wellKnownText)
            {
                var primitiveType = PrimitiveType.GetEdmPrimitiveType(primitiveTypeKind);
                PropagatorResult result;

                Propagator.ExtentPlaceholderCreator.GetPropagatorResultForPrimitiveType(primitiveType, out result);

                Assert.NotNull(result);
                Assert.Equal(true, result.IsSimple);

                var geometry = result.GetSimpleValue() as DbGeometry;

                Assert.NotNull(geometry);
                Assert.NotNull(geometry.WellKnownValue);
                Assert.Equal(wellKnownText, geometry.WellKnownValue.WellKnownText);
            }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:16,代码来源:PropagatorTests.cs

示例13: 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.SByte:
             return DbType.SByte;
         case PrimitiveTypeKind.DateTime:
             return DbType.DateTime;
         case PrimitiveTypeKind.DateTimeOffset:
             return DbType.DateTimeOffset;
         case PrimitiveTypeKind.Decimal:
             return DbType.Decimal;
         case PrimitiveTypeKind.Double:
             return DbType.Double;
         case PrimitiveTypeKind.Int16:
             return DbType.Int16;
         case PrimitiveTypeKind.Int32:
             return DbType.Int32;
         case PrimitiveTypeKind.Int64:
             return DbType.Int64;
         case PrimitiveTypeKind.Single:
             return DbType.Single;
         case PrimitiveTypeKind.Time:
             return DbType.Time;
         case PrimitiveTypeKind.Guid:
             return DbType.Guid;
         case PrimitiveTypeKind.String:
             return DbType.String;
         default:
             return DbType.Object;
     }
 }
开发者ID:roji,项目名称:Npgsql,代码行数:38,代码来源:NpgsqlProviderManifest.cs

示例14: AddAggregate

        internal void AddAggregate(PrimitiveTypeKind returnTypeKind, string aggregateFunctionName, PrimitiveTypeKind collectionArgumentElementTypeKind)
        {
            Debug.Assert(!string.IsNullOrEmpty(aggregateFunctionName) && !string.IsNullOrWhiteSpace(aggregateFunctionName), "Aggregate function name should be valid");

            FunctionParameter returnParameter = CreateReturnParameter(returnTypeKind);
            FunctionParameter collectionParameter = CreateAggregateParameter(collectionArgumentElementTypeKind);

            EdmFunction function = new EdmFunction(aggregateFunctionName,
                EdmConstants.EdmNamespace,
                DataSpace.CSpace,
                new EdmFunctionPayload
                {
                    IsAggregate = true,
                    IsBuiltIn = true,
                    ReturnParameters = new FunctionParameter[] {returnParameter},
                    Parameters = new FunctionParameter[1] { collectionParameter },
                    IsFromProviderManifest = true,
                });

            function.SetReadOnly();

            this.functions.Add(function);
        }
开发者ID:uQr,项目名称:referencesource,代码行数:23,代码来源:EdmProviderManifestFunctionBuilder.cs

示例15: GetNpgsqlDbType

 internal static NpgsqlDbType GetNpgsqlDbType(PrimitiveTypeKind _primitiveType)
 {
     switch (_primitiveType)
     {
         case PrimitiveTypeKind.Binary:
             return NpgsqlDbType.Bytea;
         case PrimitiveTypeKind.Boolean:
             return NpgsqlDbType.Boolean;
         case PrimitiveTypeKind.Byte:
         case PrimitiveTypeKind.SByte:
         case PrimitiveTypeKind.Int16:
             return NpgsqlDbType.Smallint;
         case PrimitiveTypeKind.DateTime:
             return NpgsqlDbType.Timestamp;
         case PrimitiveTypeKind.DateTimeOffset:
             return NpgsqlDbType.TimestampTZ;
         case PrimitiveTypeKind.Decimal:
             return NpgsqlDbType.Numeric;
         case PrimitiveTypeKind.Double:
             return NpgsqlDbType.Double;
         case PrimitiveTypeKind.Int32:
             return NpgsqlDbType.Integer;
         case PrimitiveTypeKind.Int64:
             return NpgsqlDbType.Bigint;
         case PrimitiveTypeKind.Single:
             return NpgsqlDbType.Real;
         case PrimitiveTypeKind.Time:
             return NpgsqlDbType.Interval;
         case PrimitiveTypeKind.Guid:
             return NpgsqlDbType.Uuid;
         case PrimitiveTypeKind.String:
             // Send strings as unknowns to be compatible with other datatypes than text
             return NpgsqlDbType.Unknown;
         default:
             return NpgsqlDbType.Unknown;
     }
 }
开发者ID:dougdelabrida,项目名称:npgsql,代码行数:37,代码来源:NpgsqlProviderManifest.cs


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