• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# PrimitiveTypeKind类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: PrimitiveType

		private PrimitiveType(JniWrapper vm, PrimitiveTypeKind kind)
		{
			_kind = kind;
			_vm = vm;
		}
开发者ID:shimondoodkin,项目名称:DarkNotes,代码行数:5,代码来源:PrimitiveType.cs


示例17: CreatePrimitiveType

 // <summary>
 // Initialize the primitive type with the given
 // </summary>
 // <param name="clrType"> The CLR type of this type </param>
 // <param name="primitiveTypeKind"> The primitive type kind of the primitive type </param>
 private PrimitiveType CreatePrimitiveType(Type clrType, PrimitiveTypeKind primitiveTypeKind)
 {
     // Figures out the base type
     var baseType = MetadataItem.EdmProviderManifest.GetPrimitiveType(primitiveTypeKind);
     var primitiveType = new PrimitiveType(clrType, baseType, this);
     primitiveType.SetReadOnly();
     return primitiveType;
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:13,代码来源:ClrProviderManifest.cs


示例18: BuildParameter

        private static ParameterModel BuildParameter(
            PrimitiveTypeKind primitiveTypeKind,
            object defaultValue,
            string defaultValueSql = null,
            int? maxLength = null,
            byte? precision = null,
            byte? scale = null,
            bool? unicode = null,
            bool? fixedLength = null,
            string name = null,
            string storeType = null,
            bool outParameter = false)
        {
            var parameter
                = new ParameterModel(primitiveTypeKind)
                      {
                          MaxLength = maxLength,
                          Precision = precision,
                          Scale = scale,
                          IsUnicode = unicode,
                          IsFixedLength = fixedLength,
                          DefaultValue = defaultValue,
                          DefaultValueSql = defaultValueSql,
                          Name = name,
                          StoreType = storeType,
                          IsOutParameter = outParameter
                      };

            return parameter;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:30,代码来源:ParameterBuilder.cs


示例19: GetMappedPrimitiveType

 /// <summary>
 /// Given the canonical primitive type, get the mapping primitive type in the given dataspace
 /// </summary>
 /// <param name="primitiveTypeKind">canonical primitive type</param>
 /// <returns>The mapped scalar type</returns>
 internal override PrimitiveType GetMappedPrimitiveType(PrimitiveTypeKind primitiveTypeKind)
 {
     PrimitiveType type = null;
     _primitiveTypeMaps.TryGetType(primitiveTypeKind, null, out type);
     return type;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:EdmItemCollection.cs


示例20: GetEdmPrimitiveType

 public static PrimitiveType GetEdmPrimitiveType(PrimitiveTypeKind primitiveTypeKind)
 {
     return EdmProviderManifest.GetPrimitiveType(primitiveTypeKind);
 }
开发者ID:junxy,项目名称:entityframework,代码行数:4,代码来源:PrimitiveType.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Principal类代码示例发布时间:2022-05-24
下一篇:
C# PrimitiveTypeCode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap