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(); }
public static ITestHarness Create(RavenSettings dbConfig) { RavenRepository ravenRepository = new RavenRepository(dbConfig); ravenRepository.DropDatabase(dbConfig.Database); return(new RavenTestHarness(ravenRepository)); }
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; }
// 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)]); }
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 }
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); }
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); }
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 ); }
//[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 }
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()); }
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"]); }
private RavenTestHarness(RavenRepository ravenRepository) { this.ravenRepository = ravenRepository; DataStore = new DataStore(this.ravenRepository, this.messageAggregator); }
public HomeController(RavenRepository repository) { _repository = repository; }
public GeneralLedgerRepository(RavenRepository repository, IMappingEngine mappingEngine) { _repository = repository; _mappingEngine = mappingEngine; }
public ImportRepository(RavenRepository repository, IMappingEngine mappingEngine) { _repository = repository; _mappingEngine = mappingEngine; }
public AccountIdentifierRepository(RavenRepository repository, IMappingEngine mappingEngine) { _repository = repository; _mappingEngine = mappingEngine; }