protected void AndGivenAUnitOfWork()
        {
            // instance be application scope
            var config = DapperConfiguration
                         .Use()
                         .UseSqlDialect(new SqlServerDialect());

            var classMapper = new CustomEntityMap <MyEntity>();

            classMapper.SetIdentityGenerated(m => m.Id);

            var classMappers = new List <IClassMapper>
            {
                classMapper
            };

            classMappers.Each(m => config.Register(m));

            // only one supported for the time being
            var tranCommitPolicy = new CommitPolicyNoOp();

            this._unitOfWork = new UnitOfWorkLinq <MyEntity, int>(
                session => new RepositoryLinq <MyEntity, int>(session),
                new SessionFactory(_conString, config),
                tranCommitPolicy);
        }
示例#2
0
        static UnitOfWorkManagesTransactionsStoryBase()
        {
            // can only be configured once per entity
            _config = DapperConfiguration
                      .Use()
                      .UseSqlDialect(new SqlServerDialect());

            var classMapper = new CustomEntityMap <TestEntity>();

            classMapper.SetIdentityGenerated(m => m.Id);

            var classMappers = new List <IClassMapper>
            {
                classMapper
            };

            classMappers.Each(n => _config.Register(n));
        }
示例#3
0
        protected void AndGivenADapperConfiguration()
        {
            // instance be application scope
            _config = DapperConfiguration
                      .Use()
                      .UseSqlDialect(new SqlServerDialect());

            var classMapper = new CustomEntityMap <MyEntity>();

            classMapper.SetIdentityGenerated(m => m.Id);

            var classMappers = new List <IClassMapper>
            {
                classMapper
            };

            classMappers.Each(n => _config.Register(n));
        }