Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var ravenStore   = RavenDb.Init(ConsistencyOptions.None, null);
            var ravenSession = ravenStore.OpenAsyncSession();

            var martenStore = Marten.DocumentStore.For(x =>
            {
                x.Connection("host=localhost;database=StudioHub;password=admin;username=postgres");

                x.Schema.Include <ImportRegistry>();
            });
            var martenSession = martenStore.OpenSession();

            var repo = new RavenRepository <Release>(ravenSession);

            for (int i = 200; i < 350; i++)
            {
                Console.WriteLine($"loading page {i}");
                var releases = repo.GetAll(i, 1024).GetAwaiter().GetResult();

                foreach (var release in releases)
                {
                    martenSession.Store <Release>(release);
                }

                martenSession.SaveChangesAsync().GetAwaiter().GetResult();
            }

            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static ITestHarness Create(RavenSettings dbConfig)
        {
            RavenRepository ravenRepository = new RavenRepository(dbConfig);

            ravenRepository.DropDatabase(dbConfig.Database);

            return(new RavenTestHarness(ravenRepository));
        }
Exemplo n.º 3
0
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            if (controllerType == null) return base.GetControllerInstance(requestContext,controllerType);

            var docStore = HttpContext.Current.Application["DocumentStore"] as DocumentStore;
            var repository = new RavenRepository( docStore );

            return Activator.CreateInstance(controllerType, repository) as IController;
        }
Exemplo n.º 4
0
// ReSharper restore StaticFieldInGenericType

        public static IRepository <T> GetRepository()
        {
            if (!_repositories.ContainsKey(typeof(T)))
            {
                var repo = new RavenRepository <T>(ObjectContextFactory.GetStore());
                _repositories.Add(typeof(T), repo);
            }

            return(_repositories[typeof(T)]);
        }
Exemplo n.º 5
0
 public void SearchTest()
 {
     var docStore = new Raven.Client.Document.DocumentStore { Url = "http://localhost:8080", DefaultDatabase = "TestDB" };
       docStore.Initialize();
       RavenRepository repository = new RavenRepository(docStore);
       ProductsController target = new ProductsController(repository); // TODO: Initialize to an appropriate value
       string searchStr = "Acer*";
       ActionResult actual;
       actual = target.Search(searchStr);
       Assert.IsNotNull(actual); //TODO: Improve assert here
 }
Exemplo n.º 6
0
        public Program(IDocumentSession documentSession)
        {
            var competitionRespository = new RavenRepository<Competition>(documentSession);
            var sessionRepository = new RavenRepository<Session>(documentSession);

            this.UnitOfWork = new RavenUnitOfWork(documentSession, competitionRespository, sessionRepository);

            this.OperationChecker = new OperationChecker(competitionRespository);
            this.CompetitionService = new CompetitionService(this.UnitOfWork);
            this.SessionService = new SessionService(this.UnitOfWork);
        }
Exemplo n.º 7
0
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            if (controllerType == null)
            {
                return(base.GetControllerInstance(requestContext, controllerType));
            }

            var docStore   = HttpContext.Current.Application["DocumentStore"] as DocumentStore;
            var repository = new RavenRepository(docStore);

            return(Activator.CreateInstance(controllerType, repository) as IController);
        }
Exemplo n.º 8
0
        public void AddTest()
        {
            var docStore = new Raven.Client.Document.DocumentStore { Url = "http://localhost:8080", DefaultDatabase =  "UnitTestDB"};
              docStore.Initialize();
              var rep = new RavenRepository(docStore);
              createTestData();
              rep.Add<CategoryTree>(_testData);
              rep.Save();

             var result = rep.All<CategoryTree>().FirstOrDefault();

              Assert.IsNotNull(result);
              Assert.IsInstanceOfType(result,typeof(CategoryTree));
              Assert.IsTrue(result.Root.SubCategories.Count()==2 );
        }
Exemplo n.º 9
0
        //[HostType("ASP.NET")]
        //[AspNetDevelopmentServerHost("C:\\gitRepositories\\StingyPrice\\StingyPrice", "/")]
        //[UrlToTest("http://localhost:57460/")]
        public void SearchTest()
        {
            var docStore = new Raven.Client.Document.DocumentStore {
                Url = "http://localhost:8080", DefaultDatabase = "TestDB"
            };

            docStore.Initialize();
            RavenRepository    repository = new RavenRepository(docStore);
            ProductsController target     = new ProductsController(repository); // TODO: Initialize to an appropriate value
            string             searchStr  = "Acer*";
            ActionResult       actual;

            actual = target.Search(searchStr);
            Assert.IsNotNull(actual); //TODO: Improve assert here
        }
Exemplo n.º 10
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            IServiceBus serviceBus = new MsmqServiceBus();
            //IServiceBus serviceBus = new FakeServiceBus();
            IRepository repository = new RavenRepository();

            IoCManager.InjectInstance<IServiceBus>(serviceBus);
            IoCManager.InjectInstance<IEventStore>(new RavenEventStore(repository, serviceBus));
            //IoCManager.InjectInstance<IEventStore>(new FakeEventStore(serviceBus));

            ProcessHandler.RegisterHandlers(new ReadOnlyStore(repository), serviceBus);

            ControllerBuilder.Current.SetControllerFactory(new CustomControllerFactory());
        }
Exemplo n.º 11
0
        public void AddTest()
        {
            var docStore = new Raven.Client.Document.DocumentStore {
                Url = "http://localhost:8080", DefaultDatabase = "UnitTestDB"
            };

            docStore.Initialize();
            var rep = new RavenRepository(docStore);

            createTestData();
            rep.Add <CategoryTree>(_testData);
            rep.Save();

            var result = rep.All <CategoryTree>().FirstOrDefault();

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(CategoryTree));
            Assert.IsTrue(result.Root.SubCategories.Count() == 2);
        }
        public TesterForm()
        {
            InitializeComponent();
            ResetFields();

            _documentStore = new DocumentStore
                             {
                                 ConnectionStringName =
                                     "RavenDbConnection",
                                 Conventions = new DocumentConvention
                                               {
                                                   DefaultQueryingConsistency =
                                                       ConsistencyOptions.AlwaysWaitForNonStaleResultsAsOfLastWrite
                                               }
                             };
            _productRepository = new RavenRepository<ProductStockInformationEntity>(_documentStore);
            _proposalRepository = new RavenRepository<PurchaseProposalEntity>(_documentStore);

            _stockDaysThreshold = int.Parse(ConfigurationManager.AppSettings["StockDaysThreshold"]);
        }
Exemplo n.º 13
0
 private RavenTestHarness(RavenRepository ravenRepository)
 {
     this.ravenRepository = ravenRepository;
     DataStore            = new DataStore(this.ravenRepository, this.messageAggregator);
 }
Exemplo n.º 14
0
 public HomeController(RavenRepository repository)
 {
     _repository = repository;
 }
Exemplo n.º 15
0
 public GeneralLedgerRepository(RavenRepository repository, IMappingEngine mappingEngine)
 {
     _repository = repository;
     _mappingEngine = mappingEngine;
 }
Exemplo n.º 16
0
 public ImportRepository(RavenRepository repository, IMappingEngine mappingEngine)
 {
     _repository = repository;
     _mappingEngine = mappingEngine;
 }
 public AccountIdentifierRepository(RavenRepository repository, IMappingEngine mappingEngine)
 {
     _repository = repository;
     _mappingEngine = mappingEngine;
 }
Exemplo n.º 18
0
 public HomeController(RavenRepository repository)
 {
     _repository = repository;
 }