示例#1
0
        /// <summary>
        /// Creates a wrapped version of the cursor
        /// </summary>
        /// <param name="provider">Channel provider</param>
        /// <param name="input">The input cursor</param>
        /// <param name="bindings">The bindings object, </param>
        public BindingsWrappedRowCursor(IChannelProvider provider, IRowCursor input, ColumnBindingsBase bindings)
            : base(provider, input)
        {
            Ch.CheckValue(input, nameof(input));
            Ch.CheckValue(bindings, nameof(bindings));

            _bindings = bindings;
        }
示例#2
0
        private static Schema CreateSchema(ColumnBindingsBase inputBindings)
        {
            Contracts.CheckValue(inputBindings, nameof(inputBindings));

            var builder = new SchemaBuilder();

            for (int i = 0; i < inputBindings.ColumnCount; i++)
            {
                var meta = new MetadataBuilder();
                foreach (var kvp in inputBindings.GetMetadataTypes(i))
                {
                    var getter = Utils.MarshalInvoke(GetMetadataGetterDelegate <int>, kvp.Value.RawType, inputBindings, i, kvp.Key);
                    meta.Add(kvp.Key, kvp.Value, getter);
                }
                builder.AddColumn(inputBindings.GetColumnName(i), inputBindings.GetColumnType(i), meta.GetMetadata());
            }

            return(builder.GetSchema());
        }
示例#3
0
        private static Delegate GetMetadataGetterDelegate <TValue>(ColumnBindingsBase bindings, int col, string kind)
        {
            ValueGetter <TValue> getter = (ref TValue value) => bindings.GetMetadata(kind, col, ref value);

            return(getter);
        }