ado.net - how to have indexer object containing data of a database row without DataRow/DataReader in C# -
i'm having 2 wrapper classes contain datareader , datarow, respectively. wrapper classes implement same interface iindexer. used because have lots of methods indexes columns values:
here example: how can read datarow or datareader using same code?
now need have 3rd option insert-statements. there's no datatables datarow , no need read db.
this mayber done having indexerwrapper (or dictionarywrapper):
public class indexerwrapper : iindexer { private readonly dictionary<string, object> _indexer; public datareaderwrapper(dictionary<string, object> indexer) { _indexer = indexer; } public object this[string index] { { return _indexer[index]; } } }
i have column information of database table loop columns , add column names keys.
is there better way it? not handy because have initialize it. performance? in future used large masses , column names stored each item. there overhead compared collection of datarows?
thanks -matti
Comments
Post a Comment