Example #1
0
        public void FlushUpdatesEntityId()
        {
            var         factory = new TransManagerFactoryEF(new ModelCreator());
            DtoResponse response;
            string      msg;

            using (var manager = factory.CreateManager())
            {
                response = manager.ExecuteCommand(DeleteTestCustomer);
                msg      = response.Response.BusinessException != null
                ? response.Response.BusinessException.Message
                : "UnKnown error when deleting records";

                Assert.IsFalse(response.Response.HasException, msg);
            }
            using (var manager = factory.CreateManager())
            {
                response = manager.ExecuteCommand(CreateCustomer);
                msg      = response.Response.BusinessException != null
                ? response.Response.BusinessException.Message
                : "UnKnown error when creating customer";

                Assert.IsFalse(response.Response.HasException, msg);
            }
            using (var manager = factory.CreateManager())
            {
                response = manager.ExecuteCommand(CheckOnlyOneCustomer);
                msg      = response.Response.BusinessException != null
                ? response.Response.BusinessException.Message
                : "UnKnown error when checking customer";

                Assert.IsFalse(response.Response.HasException, msg);
            }
        }
 public void Install()
 {
     EntityToModel.Install();
       ModelToEntity.Install();
       var factory = new TransManagerFactoryEF(ModelCreator);
       using (var transManager = factory.CreateManager())
       {
     transManager.ExecuteCommand(locator =>
     {
       var haulier = locator.FindAll<Haulier>().SingleOrDefault(h => h.Name == "BlueWhale");
       if (haulier != null)
       {
     return Mapper.Map<Haulier, HaulierModel>(haulier);
       }
       haulier = Haulier.Create(locator, new HaulierModel { Name = "BlueWhale" });
       return Mapper.Map<Haulier, HaulierModel>(haulier);
     });
       }
 }
Example #3
0
        public void Install()
        {
            EntityToModel.Install();
            ModelToEntity.Install();
            var factory = new TransManagerFactoryEF(ModelCreator);

            using (var transManager = factory.CreateManager())
            {
                transManager.ExecuteCommand(locator =>
                {
                    var haulier = locator.FindAll <Haulier>().SingleOrDefault(h => h.Name == "BlueWhale");
                    if (haulier != null)
                    {
                        return(Mapper.Map <Haulier, HaulierModel>(haulier));
                    }
                    haulier = Haulier.Create(locator, new HaulierModel {
                        Name = "BlueWhale"
                    });
                    return(Mapper.Map <Haulier, HaulierModel>(haulier));
                });
            }
        }