public override void Configure(Container container) { // Config a session cache container.Register <ICacheClient>(new MemoryCacheClient()); // Configure RavenDB var store = new DocumentStore { ConnectionStringName = "RavenDB" }.Initialize(); IndexCreation.CreateIndexes(Assembly.GetCallingAssembly(), store); container.Register(store); // Set the scope of the IoC created RavenDB document store to a single request container.Register(c => c.Resolve <IDocumentStore>().OpenSession()).ReusedWithin(ReuseScope.Request); // Configure the image store var imageStore = new LocalFileStore { RootPathSetting = "BaseImagePath" }.Initialize(); container.Register(imageStore); container.Register(c => c.Resolve <IImageStore>().OpenSession()).ReusedWithin(ReuseScope.Request); }
public Main() { InitializeComponent(); _simulator = new SweetsMachinesSimulator(10); _simulator.MachineEvents += _simulator_MachineEvents; var eventHubConnectionString = ConfigurationManager.AppSettings["EventHubConnectionString"]; _eventHubSender = new SweetsMachineDataSender(eventHubConnectionString); _localFileStore = new LocalFileStore(baseDir); }
public Main() { InitializeComponent(); _simulator = new SweetsMachinesSimulator(10); _simulator.MachineEvents += _simulator_MachineEvents; var eventHubConnectionString = ConfigurationManager.AppSettings["EventHubConnectionString"]; _eventHubSender = new SweetsMachineDataSender(eventHubConnectionString); var currentDir = Directory.GetCurrentDirectory(); baseDir = Path.Combine(Directory.GetCurrentDirectory(), "Data"); if (!Directory.Exists(baseDir)) { Directory.CreateDirectory(baseDir); } _localFileStore = new LocalFileStore(baseDir); }
public void Can_Get_Directory_Name() { // Arrange var relativePath = "01-test/02-test2/03-test3"; var store = new LocalFileStore(); store.Initialize("content", new NameValueCollection { { "pathSeperator", "/" }, { "rootPhysicalPath", "" } }); // Act var dirName = store.GetName(relativePath); // Assert Assert.AreEqual("03-test3", dirName); }
public async Task GraphSaves() { var people = new List <Person> { new Person { Id = 1, Name = "Person1", CityCode = "SEA", FavoritePersonId = 3, NickName = "Wheels", Age = 25, AverageIncome = 80000, HighSchoolGraduationDate = DateTime.UtcNow.Subtract(TimeSpan.FromDays(1000)) }, new Person { Id = 2, Name = "Person2", CityCode = "SFO", NickName = "Baskets", FavoritePersonId = 3, Age = 35, AverageIncome = 125000 }, new Person { Id = 3, Name = "Person3", CityCode = "LAX", FavoritePersonId = 1, Age = 45, AverageIncome = 150000, HighSchoolGraduationDate = DateTime.Now.Subtract(TimeSpan.FromDays(5000)) } }; var friendRelationships = new List <FriendRelationship> { new FriendRelationship { SourcePersonId = 1, DestinationPersonId = 2, DateMet = DateTime.Now.Subtract(TimeSpan.FromDays(100)) }, new FriendRelationship { SourcePersonId = 2, DestinationPersonId = 3, DateMet = DateTime.Now.Subtract(TimeSpan.FromDays(10)) } }; var cities = new List <City> { new City { Code = "SEA", Name = "Seattle, WA" }, new City { Code = "NYC", Name = "New\" York City" }, new City { Code = "LAX", Name = "Los Angeles" }, new City { Code = "SFO", Name = "San Francisco" } }; IRecordsProvider recordsProvider = new InMemoryRecordsProvider(people, friendRelationships, cities); IFileStore fileStore = new LocalFileStore(); var graph = new Graph(recordsProvider, fileStore); graph.AddNodeType <Person>(p => p.Id, null, p => p.Age, p => p.AverageIncome, p => p.HighSchoolGraduationDate, p => p.NickName); graph.AddNodeType <City>(c => c.Code, null, c => c.Name); graph.AddEdgeType <Person, Person>(p => p.FavoritePersonId); graph.AddEdgeType <Person, Person, FriendRelationship>(p => p.SourcePersonId, p => p.DestinationPersonId, p => p.DateMet); graph.AddEdgeType <Person, City>(p => p.CityCode); Assert.IsTrue(graph.NodeTypes.Count == 2); Assert.IsTrue(graph.EdgeTypes.Count == 3); await graph.SaveEdgesAndNodesToCsv(10, CsvFormat.Neptune); Assert.IsTrue(Directory.Exists(graph.GraphId)); }