Exemple #1
0
        public async Task <List <Settings> > GetSettings()
        {
            var mapper = new SettingsMapper();

            return((await SqlMapper.QueryAsync(_unitOfWork.Connection,
                                               "GetJobOrderSettings",
                                               new[]
            {
                typeof(Settings),
                typeof(Log)
            },
                                               obj =>
            {
                Settings bs = obj[0] as Settings;
                Log l = obj[1] as Log;
                return mapper.Map(bs, l);
            },
                                               splitOn: "ID,LogID",
                                               commandType: CommandType.StoredProcedure,
                                               transaction: _unitOfWork.Transaction)).ToList());
        }
        public void SimpleTest()
        {
            var obj1 = SettingsMapper.Map <MySettings>();

            var obj2 = new MySettings();

            SettingsMapper.Map(obj2);

            var obj3 = (MySettings)SettingsMapper.Map(typeof(MySettings), null);

            var obj4 = new MySettings();

            SettingsMapper.Map(obj4);

            Assert.AreNotEqual(obj1, obj2);
            Assert.AreNotEqual(obj1, obj3);
            Assert.AreNotEqual(obj1, obj4);

            Check(obj1);
            Check(obj2);
            Check(obj3);
            Check(obj4);
        }
Exemple #3
0
        public void ConfigureSettings(IContainer container)
        {
            var settings = SettingsMapper.Map <SiteSettings>();

            container.Configure(config => config.For <SiteSettings>().Singleton().Use(settings));
        }