Exemple #1
0
        public static void Main(string[] args)
        {
            expMapper = new ReadMapBuilder<BDataObject, BTable>(BTable.Instance)
                .Map(dObj => dObj.Id, t => t.Id)
                .Map(dObj => dObj.Name, t => t.Name)
                .Map(dObj => dObj.NameNull, t => t.NameNull)
                .Map(dObj => dObj.Rooms, t => t.Rooms)
                .Map(dObj => dObj.RoomsNull, t => t.RoomsNull)
                .Map(dObj => dObj.Verify, t => t.Verify)
                .Compile();

            handMapper = new HandMapper();
            expLikeMapper = new ExpLikeMapper();

            reader = new DataReaderCap(	new object[] {(int)123, "text Name", null, (int)321, null, true});
            model = new BDataObject();

            Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)1;

            handMapper.LoadInstance(reader, model);
            expLikeMapper.LoadInstance(reader, model);
            expMapper.LoadInstance(reader, model);

            double sh = Measure("Empty", 10000000, EmptyAction);
            Console.WriteLine();
            double h =  Measure(" Hand", 10000000, HandAction);
            Console.WriteLine("(1)");
            double el = Measure(" ExpL", 10000000, ExpLikeAction);
            Console.WriteLine("({0:G4})", el/h);
            double ex = Measure("  Exp", 10000000, ExpAction);
            Console.WriteLine("({0:G4})", ex/h);
        }
Exemple #2
0
        public void LoadPoint()
        {
            IReadMapper<MyDataObject, MyTable> mapper = new ReadMapBuilder<MyDataObject, MyTable>(MyTable.Instance)
                .Map(dObj => dObj.Id, t => t.Id)
                .Map(dObj => dObj.Location,
                    MyDataObject.ReadGeoPoint, t => t.Longitude, t => t.Lotitude)
                .Compile();

            DataReaderCap reader = new DataReaderCap(new object[] {(int)123, 0.5d, 0.2d});

            MyDataObject model = new MyDataObject();

            mapper.LoadInstance(reader, model);

            Assert.IsNotNull(model.Location);
            Assert.AreEqual(0.5d, model.Location.Value.Longitude);
            Assert.AreEqual(0.2d, model.Location.Value.Lotitude);
        }
Exemple #3
0
        public void Test()
        {
            IReadMapper<MyDataObject, MyTable> mapper = new ReadMapBuilder<MyDataObject, MyTable>(MyTable.Instance)
                .Map(dObj => dObj.Id,		t => t.Id)
                .Map(dObj => dObj.Name,		t => t.Name)
                .Map(dObj => dObj.Rooms,	t => t.Rooms)
                .Map(dObj => dObj.Verify,	t => t.Verify)
                .Compile();

            DataReaderCap reader = new DataReaderCap(new object[] {(int)123, "text Name", null, true});

            MyDataObject model = new MyDataObject();
            mapper.LoadInstance(reader, model);

            Assert.AreEqual(123, model.Id);
            Assert.AreEqual("text Name", model.Name);
            Assert.IsNull(model.Rooms);
            Assert.IsTrue(model.Verify);
        }