public static IClientTransactionRepository GetTransactionRepository()
        {
            // See if the ITransactionRepository instance was already created
            if (ClientTransactionRepositoryFactory.transactionRepository == null)
            {
                // It was not created, so build it now
                RepositorySettings settings = 
                    (RepositorySettings)ConfigurationManager.GetSection(
                    RepositoryMappingConstants.RepositoryMappingsConfigurationSectionName);

                // Get the type to be created
                Type repositoryType = 
                    Type.GetType(
                    settings.RepositoryMappings["IClientTransactionRepository"].RepositoryFullTypeName);

                // Create the repository, and cast it to the 
                // ITransactionRepository interface
                ClientTransactionRepositoryFactory.transactionRepository = 
                    Activator.CreateInstance(repositoryType) 
                    as IClientTransactionRepository;

            }

            return ClientTransactionRepositoryFactory.transactionRepository;
        }
Exemplo n.º 2
0
        public void GetTransactionRepositoryTest()
        {
            IClientTransactionRepository repository = ClientTransactionRepositoryFactory.GetTransactionRepository();

            Assert.AreNotEqual(null, repository);
            Assert.AreEqual("SqlCeClientTransactionRepository", repository.GetType().Name);
            this.testContextInstance.WriteLine("Created an ITransactionRepository of type {0}", repository.GetType().FullName);
        }
 public static IClientTransactionRepository GetTransactionRepository()
 {
     if (ClientTransactionRepositoryFactory.transactionRepository == null)
     {
         RepositorySettings settings =
             (RepositorySettings)ConfigurationManager.GetSection(RepositoryMappingConstants.RepositoryMappingsConfigurationSectionName);
         Type repositoryType = Type.GetType(settings.RepositoryMappings["IClientTransactionRepository"].RepositoryFullTypeName);
         ClientTransactionRepositoryFactory.transactionRepository = Activator.CreateInstance(repositoryType) as IClientTransactionRepository;
     }
     return(transactionRepository);
 }
Exemplo n.º 4
0
 public UnitOfWork()
 {
     this.key = Guid.NewGuid();
     this.clientTransactionRepository = ClientTransactionRepositoryFactory.GetTransactionRepository();
     this.addedEntities = new Dictionary <IEntity,
                                          IUnitOfWorkRepository>();
     this.changedEntities = new Dictionary <IEntity,
                                            IUnitOfWorkRepository>();
     this.deletedEntities = new Dictionary <IEntity,
                                            IUnitOfWorkRepository>();
 }
Exemplo n.º 5
0
 public UnitOfWork()
 {
     this.key = Guid.NewGuid();
     this.clientTransactionRepository = ClientTransactionRepositoryFactory.GetTransactionRepository();
     this.addedEntities = new Dictionary<IEntity, 
                              IUnitOfWorkRepository>();
     this.changedEntities = new Dictionary<IEntity, 
                                IUnitOfWorkRepository>();
     this.deletedEntities = new Dictionary<IEntity, 
                                IUnitOfWorkRepository>();
 }
        public static IClientTransactionRepository GetTransactionRepository()
        {
            // See if the ITransactionRepository instance was already created
            if (ClientTransactionRepositoryFactory.transactionRepository == null)
            {
                // It was not created, so build it now
                RepositorySettings settings =
                    (RepositorySettings)ConfigurationManager.GetSection(
                        RepositoryMappingConstants.RepositoryMappingsConfigurationSectionName);

                // Get the type to be created
                Type repositoryType =
                    Type.GetType(
                        settings.RepositoryMappings["IClientTransactionRepository"].RepositoryFullTypeName);

                // Create the repository, and cast it to the
                // ITransactionRepository interface
                ClientTransactionRepositoryFactory.transactionRepository =
                    Activator.CreateInstance(repositoryType)
                    as IClientTransactionRepository;
            }

            return(ClientTransactionRepositoryFactory.transactionRepository);
        }
Exemplo n.º 7
0
 public UnitOfWork()
 {
     this.key = Guid.NewGuid();
     this.clientTransactionRepository = ClientTransactionRepositoryFactory.GetTransactionRepository();
     this.operations = new List <Operation>();
 }