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


C# SqlTypeCode类代码示例

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


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

示例1: NumericType

 public NumericType(SqlTypeCode typeCode, int precision, int scale)
     : base("NUMERIC", typeCode)
 {
     AssertIsNumeric(typeCode);
     Precision = precision;
     Scale = scale;
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:NumericType.cs

示例2: GetRuntimeType

        public void GetRuntimeType(SqlTypeCode code, Type expectedType)
        {
            var type = PrimitiveTypes.Interval(code);
            var objType = type.GetRuntimeType();

            Assert.AreEqual(expectedType, objType);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:IntervalTypeTests.cs

示例3: NumericType

 public NumericType(SqlTypeCode sqlType, int size, byte scale)
     : base("NUMERIC", sqlType)
 {
     AssertIsNumeric(sqlType);
     Size = size;
     Scale = scale;
 }
开发者ID:prepare,项目名称:deveeldb,代码行数:7,代码来源:NumericType.cs

示例4: ColumnAttribute

 public ColumnAttribute(string name, SqlTypeCode type, int size, int scale)
 {
     ColumnName = name;
     SqlType = type;
     Size = size;
     Scale = scale;
 }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:7,代码来源:ColumnAttribute.cs

示例5: GetRuntime

        public static void GetRuntime(SqlTypeCode code, Type expectedType)
        {
            var type = PrimitiveTypes.Numeric(code);

            var runtimeType = type.GetRuntimeType();
            Assert.AreEqual(expectedType, runtimeType);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:7,代码来源:NumericTypeTests.cs

示例6: ParseString

        public void ParseString(string input, SqlTypeCode typeCode)
        {
            var sqlType = SqlType.Parse(input);

            Assert.IsNotNull(sqlType);
            Assert.IsInstanceOf<DateType>(sqlType);
            Assert.AreEqual(typeCode, sqlType.TypeCode);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:8,代码来源:DateTypeTests.cs

示例7: ParseString

        public void ParseString(string input, SqlTypeCode expected)
        {
            var type = SqlType.Parse(input);

            Assert.IsNotNull(type);
            Assert.IsInstanceOf<IntervalType>(type);

            Assert.AreEqual(expected, type.TypeCode);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:9,代码来源:IntervalTypeTests.cs

示例8: StringType

        public StringType(SqlTypeCode typeCode, int maxSize, Encoding encoding, CultureInfo locale)
            : base("STRING", typeCode)
        {
            if (encoding == null)
                throw new ArgumentNullException("encoding");

            AssertIsString(typeCode);
            MaxSize = maxSize;
            Locale = locale;
            Encoding = encoding;
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:11,代码来源:StringType.cs

示例9: CastToString

        public void CastToString(SqlTypeCode typeCode, bool value, string expected)
        {
            var type = PrimitiveTypes.Boolean(typeCode);

            var boolean = new SqlBoolean(value);

            var casted = type.CastTo(boolean, PrimitiveTypes.String());

            Assert.IsInstanceOf<SqlString>(casted);
            Assert.AreEqual(expected, casted.ToString());
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:11,代码来源:BooleanTypeTest.cs

示例10: Resolve

        public static SqlType Resolve(SqlTypeCode typeCode, string typeName, DataTypeMeta[] metadata, ITypeResolver resolver)
        {
            if (PrimitiveTypes.IsPrimitive(typeCode))
                return PrimitiveTypes.Resolve(typeCode, typeName, metadata);

            if (resolver == null)
                throw new NotSupportedException(String.Format("Cannot resolve type '{0}' without context.", typeName));

            var resolveCcontext = new TypeResolveContext(typeCode, typeName, metadata);
            return resolver.ResolveType(resolveCcontext);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:11,代码来源:TypeResolver.cs

示例11: ParseString

        public static void ParseString(string input, SqlTypeCode expectedTypeCode, int expectedSize)
        {
            var sqlType = SqlType.Parse(input);

            Assert.IsNotNull(sqlType);
            Assert.IsInstanceOf<BinaryType>(sqlType);
            Assert.AreEqual(expectedTypeCode, sqlType.TypeCode);

            var binType = (BinaryType) sqlType;
            Assert.AreEqual(expectedSize, binType.MaxSize);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:11,代码来源:BinaryTypeTests.cs

示例12: TypeResolveContext

        public TypeResolveContext(SqlTypeCode typeCode, string typeName, DataTypeMeta[] meta)
        {
            TypeCode = typeCode;
            TypeName = typeName;

            this.meta = new Dictionary<string, DataTypeMeta>(StringComparer.OrdinalIgnoreCase);

            if (meta != null) {
                foreach (var typeMeta in meta) {
                    this.meta[typeMeta.Name] = typeMeta;
                }
            }
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:13,代码来源:TypeResolveContext.cs

示例13: CreateFrom

        public static void CreateFrom(SqlTypeCode code, int precision, int scale, object value)
        {
            var type = PrimitiveTypes.Numeric(code, precision, scale);

            var result = type.CreateFrom(value);
            Assert.IsNotNull(result);
            Assert.IsFalse(result.IsNull);
            Assert.IsInstanceOf<SqlNumber>(result);

            var number = (SqlNumber) result;
            Assert.AreEqual(scale, number.Scale);
            Assert.AreEqual(precision, number.Precision);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:13,代码来源:NumericTypeTests.cs

示例14: Boolean

 public static BooleanType Boolean(SqlTypeCode sqlType)
 {
     return new BooleanType(sqlType);
 }
开发者ID:furesoft,项目名称:deveeldb,代码行数:4,代码来源:PrimitiveTypes.cs

示例15: DateTime

 public static DateType DateTime(SqlTypeCode sqlType)
 {
     return new DateType(sqlType);
 }
开发者ID:furesoft,项目名称:deveeldb,代码行数:4,代码来源:PrimitiveTypes.cs


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