Exemple #1
0
        /// <summary>
        /// 初始化辅助数据写入器。
        /// </summary>
        /// <param name="dataWriter">原始数据写入器</param>
        /// <param name="valueFilter">数据筛选器</param>
        public DataFilterWriter(IDataWriter <TKey> dataWriter, IValueFilter <TKey> valueFilter)
        {
            DataWriter  = dataWriter;
            ValueFilter = valueFilter;

            ValueInfo = new ValueFilterInfo <TKey>();
        }
 public bool Filter(ValueFilterInfo <TIn> valueInfo)
 {
     return(valueFilter.Filter(new ValueFilterInfo <TOut>(
                                   XConvert <TOut> .Convert(valueInfo.Key),
                                   valueInfo.Type,
                                   valueInfo.ValueCopyer
                                   )));
 }
        public void OnReadAll(IDataWriter <TKey> dataWriter, IValueFilter <TKey> valueFilter)
        {
            var valueInfo = new ValueFilterInfo <TKey>();

            foreach (var item in content)
            {
                ValueInterface <TValue> .WriteValue(valueInfo.ValueCopyer, item.Value);

                valueInfo.Key  = item.Key;
                valueInfo.Type = typeof(TValue);

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
Exemple #4
0
        public void OnReadAll(IDataWriter<int> dataWriter, IValueFilter<int> valueFilter)
        {
            var valueInfo = new ValueFilterInfo<int>();

            for (int i = 0; i < Content.Tables.Count; i++)
            {
                OnReadValue(i, valueInfo.ValueCopyer);

                valueInfo.Key = i;
                valueInfo.Type = typeof(DataTable);

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
Exemple #5
0
        public void OnReadAll(IDataWriter <object> dataWriter, IValueFilter <object> valueFilter)
        {
            var valueInfo = new ValueFilterInfo <object>();

            foreach (DictionaryEntry item in content)
            {
                ValueInterface.WriteValue(valueInfo.ValueCopyer, item.Value);

                valueInfo.Key  = item.Key;
                valueInfo.Type = typeof(object);

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
Exemple #6
0
        public void OnReadAll(IDataWriter <string> dataWriter, IValueFilter <string> valueFilter)
        {
            var valueInfo = new ValueFilterInfo <string>();

            foreach (DataColumn item in Content.Table.Columns)
            {
                ValueInterface.GetInterface(item.DataType).Write(valueInfo.ValueCopyer, Content[item.Ordinal]);

                valueInfo.Key  = item.ColumnName;
                valueInfo.Type = item.DataType;

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
        public override void OnReadAll(IDataWriter <int> dataWriter, IValueFilter <int> valueFilter)
        {
            int length = Count;

            var valueInfo = new ValueFilterInfo <int>();

            for (int i = 0; i < length; ++i)
            {
                valueInfo.ValueCopyer.WriteArray(new ChildrenRW(this, i));

                valueInfo.Key  = i;
                valueInfo.Type = typeof(T[]);

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
Exemple #8
0
        public void OnReadAll(IDataWriter <int> dataWriter, IValueFilter <int> valueFilter)
        {
            int length = Count;

            var valueInfo = new ValueFilterInfo <int>();

            for (int i = 0; i < length; i++)
            {
                OnReadValue(i, valueInfo.ValueCopyer);

                valueInfo.Key  = i;
                valueInfo.Type = valueInfo.ValueCopyer.Type;

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[i]);
                }
            }
        }
Exemple #9
0
        public void OnReadAll(IDataWriter <string> dataWriter, IValueFilter <string> valueFilter)
        {
            int length = Count;

            var valueInfo = new ValueFilterInfo <string>();

            for (int i = 0; i < length; i++)
            {
                OnReadValue(i, valueInfo.ValueCopyer);

                valueInfo.Key  = Content.Columns[i].ColumnName;
                valueInfo.Type = valueInfo.ValueCopyer.Type;

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
Exemple #10
0
        public void OnReadAll(IDataWriter <int> dataWriter, IValueFilter <int> valueFilter)
        {
            int count = content.Count;

            var valueInfo = new ValueFilterInfo <int>();

            for (int i = 0; i < count; i++)
            {
                var value = content[i];

                ValueInterface <TValue> .Content.WriteValue(valueInfo.ValueCopyer, value);

                valueInfo.Key  = i;
                valueInfo.Type = typeof(TValue);

                if (valueFilter.Filter(valueInfo))
                {
                    valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                }
            }
        }
            public void OnReadAll(IDataWriter <int> dataWriter, IValueFilter <int> valueFilter)
            {
                int length = Count;

                var valueInfo = new ValueFilterInfo <int>();

                for (int i = 0; i < length; ++i)
                {
                    var value = content.content[baseIndex, i];

                    ValueInterface <T> .WriteValue(valueInfo.ValueCopyer, value);

                    valueInfo.Key  = i;
                    valueInfo.Type = typeof(T);

                    if (valueFilter.Filter(valueInfo))
                    {
                        valueInfo.ValueCopyer.WriteTo(dataWriter[valueInfo.Key]);
                    }
                }
            }