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

C# IColumnInfo类代码示例

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

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



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

示例1: InvConvertFromCustom

 public static byte[] InvConvertFromCustom(IColumnInfo type_info, object value)
 {
     CheckArgument<byte[]>(value);
     return (byte[])value;
     //            CheckArgument<string>(value);
     //            return Encoding.UTF8.GetBytes((string)value);
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:7,代码来源:TypeInterpreter+Custom.cs


示例2: InvConvertFromList

        public static byte[] InvConvertFromList(IColumnInfo type_info, object value)
        {
            var listType = GetTypeFromList(type_info);
            CheckArgument(listType, value);
            var list_typecode = (type_info as ListColumnInfo).ValueTypeCode;
            var list_typeinfo = (type_info as ListColumnInfo).ValueTypeInfo;

            List<byte[]> bufs = new List<byte[]>();
            int cnt = 0;
            int bsize = 2;
            foreach (var obj in (value as IEnumerable))
            {
                var buf = TypeInterpreter.InvCqlConvert(obj, list_typecode, list_typeinfo);
                bufs.Add(buf);
                bsize += buf.Length;
                cnt++;
            }
            var ret = new byte[bsize];

            var cntbuf = Int16ToBytes((short)cnt);

            int idx = 0;
            Buffer.BlockCopy(cntbuf, 0, ret, 0, 2);
            idx += 2;
            foreach (var buf in bufs)
            {
                Buffer.BlockCopy(buf, 0, ret, idx, buf.Length);
                idx += buf.Length;
            }

            return ret;
        }
开发者ID:sdether,项目名称:csharp-driver,代码行数:32,代码来源:TypeInterpreter+List.cs


示例3: ConvertFromInet

 public static object ConvertFromInet(IColumnInfo type_info, byte[] value, Type cSharpType)
 {
     if (value.Length == 4 || value.Length == 16)
     {
         var ip = new IPAddress(value);
         return new IPEndPoint(ip, 0);
     }
     else
     {
         var length = value[0];
         IPAddress ip;
         int port;
         var buf = new byte[length];
         if (length == 4)
         {
             Buffer.BlockCopy(value, 1, buf, 0, 4);
             ip = new IPAddress(buf);
             port = BytesToInt32(buf, 1 + 4);
             return new IPEndPoint(ip, port);
         }
         else if (length == 16)
         {
             Buffer.BlockCopy(value, 1, buf, 0, 16);
             ip = new IPAddress(buf);
             port = BytesToInt32(buf, 1 + 16);
             return new IPEndPoint(ip, port);
         }
     }
     throw new DriverInternalError("Invalid lenght of Inet Addr");
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:30,代码来源:TypeInterpreter+Inet.cs


示例4: InvConvertFromBoolean

 public static byte[] InvConvertFromBoolean(IColumnInfo type_info, object value)
 {
     CheckArgument<bool>(value);
     var buffer = new byte[1];
     buffer[0] = ((bool)value) ? (byte)0x01 : (byte)0x00;
     return buffer;
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:7,代码来源:TypeInterpreter+Boolean.cs


示例5: ColumnMap

        public ColumnMap(MemberInfo member, IColumnInfo columnInfo)
        {
            FieldName = member.Name;
            ColumnInfo = columnInfo;

            // If the column name is not specified, the field name will be used.
            if (string.IsNullOrEmpty(columnInfo.Name))
                columnInfo.Name = member.Name;

            FieldType = ReflectionHelper.GetMemberType(member);
            Type paramNetType = FieldType;

            Converter = MapRepository.Instance.GetConverter(FieldType);
            if (Converter != null)
            {
                paramNetType = Converter.DbType;
            }

            DBType = MapRepository.Instance.DbTypeBuilder.GetDbType(paramNetType);

            Getter = MapRepository.Instance.ReflectionStrategy.BuildGetter(member.DeclaringType, FieldName);
            Setter = MapRepository.Instance.ReflectionStrategy.BuildSetter(member.DeclaringType, FieldName);

            if (member.MemberType == MemberTypes.Property)
            {
                PropertyInfo pi = (PropertyInfo)member;
                CanRead = pi.CanRead;
                CanWrite = pi.CanWrite;
            }
            else if (member.MemberType == MemberTypes.Field)
            {
                CanRead = true;
                CanWrite = true;
            }
        }
开发者ID:vawen,项目名称:Marr.DataMapper,代码行数:35,代码来源:ColumnMap.cs


示例6: InvConvertFromDouble

 public static byte[] InvConvertFromDouble(IColumnInfo type_info, object value)
 {
     CheckArgument<double>(value);
     byte[] ret = BitConverter.GetBytes((double)value);
     Array.Reverse(ret);
     return ret;
 }
开发者ID:joaquincasares,项目名称:csharp-driver,代码行数:7,代码来源:TypeInterpreter+Double.cs


示例7: ConvertFromTimestamp

 public static object ConvertFromTimestamp(IColumnInfo type_info, byte[] value, Type cSharpType)
 {
     if (cSharpType == null || cSharpType.Equals(typeof(DateTimeOffset)))
         return BytesToDateTimeOffset(value, 0);
     else
         return BytesToDateTimeOffset(value, 0).DateTime;
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:7,代码来源:TypeInterpreter+Timestamp.cs


示例8: ConvertFromSet

 public static object ConvertFromSet(IColumnInfo type_info, byte[] value, Type cSharpType)
 {
     if (type_info is SetColumnInfo)
     {
         var list_typecode = (type_info as SetColumnInfo).KeyTypeCode;
         var list_typeinfo = (type_info as SetColumnInfo).KeyTypeInfo;
         var value_type = TypeInterpreter.GetDefaultTypeFromCqlType(list_typecode, list_typeinfo);
         int count = BytesToInt16(value, 0);
         int idx = 2;
         var openType = typeof(List<>);
         var listType = openType.MakeGenericType(value_type);
         object ret = Activator.CreateInstance(listType);
         var addM = listType.GetMethod("Add");
         for (int i = 0; i < count; i++)
         {
             var val_buf_len = BytesToInt16(value, idx);
             idx += 2;
             byte[] val_buf = new byte[val_buf_len];
             Buffer.BlockCopy(value, idx, val_buf, 0, val_buf_len);
             idx += val_buf_len;
             addM.Invoke(ret, new object[] { TypeInterpreter.CqlConvert(val_buf, list_typecode, list_typeinfo) });
         }
         return ret;
     }
     throw new DriverInternalError("Invalid ColumnInfo");
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:26,代码来源:TypeInterpreter+Set.cs


示例9: ConfigurableColumn

        public ConfigurableColumn(ListStoreMapping mapping, IColumnInfo info, DataColumn column)
        {
            this.Mapping = mapping;
            this.ColumnInfo = info;
            this.DataColumn = column;

            this.Reorderable = true;
            this.Resizable = true;
            this.MinWidth = 20;
            this.FixedWidth = 80;
            this.Sizing = TreeViewColumnSizing.Fixed;
            this.Clickable = true;
            this.SortIndicator = false;
            this.SortOrder = SortType.Ascending;

            if(this.ColumnInfo != null)
            {
                this.Title = this.ColumnInfo.Caption;
                this.Visible = this.ColumnInfo.Visible;
            }
            else if (this.DataColumn != null)
            {
                this.Title = this.DataColumn.Caption;
            }

            CreateCellRenderers();

            this.Mapping.ColumnsStore.AddNode(this);

            this.AddNotification(NotifyChange);
            this.WidthAdjustment = new Adjustment(80, 20, 1000, 1, 2, 0);
            this.WidthAdjustment.Changed += delegate {
                this.FixedWidth = (int)(this.WidthAdjustment.Value);
            };
        }
开发者ID:langpavel,项目名称:LPS-old,代码行数:35,代码来源:ConfigurableColumn.cs


示例10: CreateColumn

 public ConfigurableColumn CreateColumn(IColumnInfo info, DataColumn column)
 {
     if(info != null)
     {
         if(!String.IsNullOrEmpty(info.FkReferenceTable))
             return new LookupColumn(this, info, column);
     }
     if(column != null)
     {
         Type type = column.DataType;
         if(type == typeof(DateTime))
             return new DateTimeColumn(this, info, column);
         else if(type == typeof(string))
             return new StringColumn(this, info, column);
         else if(type == typeof(bool))
             return new CheckBoxColumn(this, info, column);
         else if(type == typeof(Decimal))
             return new DecimalColumn(this, info, column);
         else if(type == typeof(Int64))
             return new Int64Column(this, info, column);
         else if(type == typeof(Int32))
             return new Int64Column(this, info, column);
         throw new Exception("Nelze vytvořit sloupeček pro typ " + type.ToString());
     }
     throw new Exception("Nelze vytvořit sloupeček");
 }
开发者ID:langpavel,项目名称:LPS-old,代码行数:26,代码来源:ListStoreMapping.cs


示例11: InvConvertFromTimestamp

 public static byte[] InvConvertFromTimestamp(IColumnInfo type_info, object value)
 {
     CheckArgument<DateTimeOffset, DateTime>(value);
     if(value is DateTimeOffset)
         return DateTimeOffsetToBytes((DateTimeOffset)value);
     else
         return DateTimeOffsetToBytes(new DateTimeOffset((DateTime)value));
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:8,代码来源:TypeInterpreter+Timestamp.cs


示例12: InvConvertFromVarint

        public static byte[] InvConvertFromVarint(IColumnInfo type_info, object value)
        {
            CheckArgument<BigInteger>(value);
            var ret  = ((BigInteger)value).ToByteArray();

            Array.Reverse(ret);
            return ret;
        }
开发者ID:sdether,项目名称:csharp-driver,代码行数:8,代码来源:TypeInterpreter+Varint.cs


示例13: Deserialize

 public override object Deserialize(ushort protocolVersion, byte[] buffer, int offset, int length, IColumnInfo typeInfo)
 {
     DeserializationCounter++;
     if (_fixedValue)
     {
         return Utils.SliceBuffer(buffer, offset, length);
     }
     return base.Deserialize(protocolVersion, buffer, offset, length, typeInfo);
 }
开发者ID:yar1k0v,项目名称:csharp-driver,代码行数:9,代码来源:UdtSerializerWrapper.cs


示例14: Deserialize

 public object Deserialize(ushort protocolVersion, byte[] buffer, int offset, int length, IColumnInfo typeInfo)
 {
     buffer = Utils.SliceBuffer(buffer, offset, length);
     if (_reverse)
     {
         Array.Reverse(buffer);   
     }
     return _adapter.ConvertFrom(buffer);
 }
开发者ID:alprema,项目名称:csharp-driver,代码行数:9,代码来源:LegacyTypeSerializer.cs


示例15: BuildPropertieStr

        public string BuildPropertieStr(IColumnInfo column)
        {
            StringBuilder sb = new StringBuilder();
            bool hasvalue = false;
            sb.AppendFormat("this.Property(t => t.{0})", column.PascalName);

            if (column.Identity)
            {
                hasvalue = true;
                sb.Append("\r\n                ");
                sb.Append(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)");
            }

            if (column.Computed)
            {
                hasvalue = true;
                sb.Append("\r\n                ");
                sb.Append(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed)");
            }

            if (column.IsPrimaryKey)
            {
                if (!column.Identity)
                {
                    hasvalue = true;
                    sb.Append("\r\n                ");
                    sb.Append(".HasDatabaseGeneratedOption(DatabaseGeneratedOption.None)");
                }
            }

            //if (!column.HasStringLength && column.Nullable)
            //    return string.Empty;

            if (column.HasStringLength)
            {
                hasvalue = true;
                sb.Append("\r\n                ");
                sb.AppendFormat(".HasMaxLength({0})", column.MaxLength);
            }

            if (!column.Nullable && !column.IsPrimaryKey && !column.Identity && !column.Computed)
            {
                hasvalue = true;
                sb.Append("\r\n                ");
                sb.Append(".IsRequired()");
            }

            if(!hasvalue)
            {
                return string.Empty;
            }

            sb.Append(";");
            return sb.ToString();
        }
开发者ID:zhh007,项目名称:CKGen,代码行数:55,代码来源:PageViewModel.cs


示例16: InvConvertFromInet

 public static byte[] InvConvertFromInet(IColumnInfo type_info, object value)
 {
     CheckArgument<IPEndPoint>(value);
     var addrbytes = (value as IPEndPoint).Address.GetAddressBytes();
     var port = Int32ToBytes((value as IPEndPoint).Port);
     var ret = new byte[addrbytes.Length + 4 + 1];
     ret[0] = (byte)addrbytes.Length;
     Buffer.BlockCopy(addrbytes, 0, ret, 1, addrbytes.Length);
     Buffer.BlockCopy(port, 0, ret, 1 + addrbytes.Length, port.Length);
     return ret;
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:11,代码来源:TypeInterpreter+Inet.cs


示例17: GetDefaultTypeFromSet

 public static Type GetDefaultTypeFromSet(IColumnInfo type_info)
 {
     if (type_info is SetColumnInfo)
     {
         var list_typecode = (type_info as SetColumnInfo).KeyTypeCode;
         var list_typeinfo = (type_info as SetColumnInfo).KeyTypeInfo;
         var value_type = TypeInterpreter.GetDefaultTypeFromCqlType(list_typecode, list_typeinfo);
         var openType = typeof(IEnumerable<>);
         var listType = openType.MakeGenericType(value_type);
         return listType;
     }
     throw new DriverInternalError("Invalid ColumnInfo");
 }
开发者ID:hjarraya,项目名称:csharp-driver,代码行数:13,代码来源:TypeInterpreter+Set.cs


示例18: InvConvertFromDecimal

        public static byte[] InvConvertFromDecimal(IColumnInfo type_info, object value)
        {
            CheckArgument<BigDecimal, decimal>(value);
            byte[] ret = null;
            if (value.GetType() == typeof(BigDecimal))
                ret = ((BigDecimal)value).ToByteArray();
            else
                if (value.GetType() == typeof(decimal))
                    ret = (new BigDecimal((decimal)value)).ToByteArray();

            Array.Reverse(ret);
            return ret;
        }
开发者ID:sdether,项目名称:csharp-driver,代码行数:13,代码来源:TypeInterpreter+Decimal.cs


示例19: InvConvertFromMap

        public static byte[] InvConvertFromMap(IColumnInfo type_info, object value)
        {
            var dicType = GetTypeFromList(type_info);
            CheckArgument(dicType, value);
            var key_typecode = (type_info as MapColumnInfo).KeyTypeCode;
            var key_typeinfo = (type_info as MapColumnInfo).KeyTypeInfo;
            var value_typecode = (type_info as MapColumnInfo).ValueTypeCode;
            var value_typeinfo = (type_info as MapColumnInfo).ValueTypeInfo;
            var key_type = TypeInterpreter.GetTypeFromCqlType(key_typecode, key_typeinfo);
            var value_type = TypeInterpreter.GetTypeFromCqlType(value_typecode, value_typeinfo);

            List<byte[]> bufs = new List<byte[]>();
            int cnt = 0;
            int bsize = 2;
                var kvoType = typeof(KeyValuePair<,>);
            var kvType  =kvoType.MakeGenericType(key_type, value_type);
            var key_prop = kvType.GetProperty("Key");
            var value_prop = kvType.GetProperty("Value");
            foreach (var kv in (value as IEnumerable))
            {
                {
                    var obj = key_prop.GetValue(kv, new object[] { });
                    var buf = TypeInterpreter.InvCqlConvert(obj, key_typecode, key_typeinfo);
                    bufs.Add(buf);
                    bsize += buf.Length;
                }
                {
                    var obj = value_prop.GetValue(kv, new object[] { });
                    var buf = TypeInterpreter.InvCqlConvert(obj, value_typecode, value_typeinfo);
                    bufs.Add(buf);
                    bsize += buf.Length;
                }
                cnt++;
            }
            var ret = new byte[bsize];

            var cntbuf = Int16ToBytes((short)cnt); // short or ushort ?

            int idx = 0;
            Buffer.BlockCopy(cntbuf, 0, ret, 0, 2);
            idx += 2;
            foreach (var buf in bufs)
            {
                Buffer.BlockCopy(buf, 0, ret, idx, buf.Length);
                idx += buf.Length;
            }

            return ret;
        }
开发者ID:sdether,项目名称:csharp-driver,代码行数:49,代码来源:TypeInterpreter+Map.cs


示例20: LookupColumn

 public LookupColumn(ListStoreMapping Mapping, IColumnInfo ColumnInfo, DataColumn DataColumn)
     : base(Mapping, ColumnInfo, DataColumn)
 {
     ILookupInfo linfo = (ILookupInfo)this.ColumnInfo;
     ds = ServerConnection.Instance.GetCachedDataSet(linfo.LookupTable);
     string[] cols = linfo.FkListReplaceFormat.Split(
         new char[] {',',';',' ',':','-','\'','"', '[', ']', '(', ')', '{', '}', '<', '>'}, StringSplitOptions.RemoveEmptyEntries);
     format = linfo.FkListReplaceFormat;
     for(int i = 0; i < cols.Length; i++)
     {
         int idx = ds.Tables[0].Columns.IndexOf(cols[i]);
         if(idx >= 0)
             format = format.Replace(cols[i], "{" + idx.ToString() + "}");
     }
 }
开发者ID:langpavel,项目名称:LPS-old,代码行数:15,代码来源:LookupColumn.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ICommand类代码示例发布时间:2022-05-24
下一篇:
C# IColumn类代码示例发布时间: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