mgravell / fast-member

Automatically exported from code.google.com/p/fast-member
Apache License 2.0
1.02k stars 137 forks source link

Add OrdinalAttribute to define explicit column order #73

Closed dyatchenko closed 5 years ago

dyatchenko commented 5 years ago

Changes:

  1. OrdinalAttribute was added to specify column order used in IDataReader
  2. Several unit tests were added to test the ordinal functionality

The ordinal attribute can be used as shown below:

        public class ObjectReaderWithDefinedColumnsOrderType
        {
            [Ordinal(1)]
            public byte C { get; set; }
            [Ordinal(0)]
            public int? D { get; set; }
        }
mgravell commented 5 years ago

I think I'm OK with this in general, however I'm going to make a minor tweak to remove the bit where it then does an implicit sort by name - that is a breaking behavior change, where-as sorting by Ordinal is fine if it doesn't change the order when that feature isn't used.

Thanks; merging, then tweaking a little.