-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
39 lines (31 loc) · 1.3 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Threading.Tasks;
using Neo4j.Driver;
namespace DriverUsageAnalysis
{
//Wrap the chosen logging framework, in this case NLog, in a Neo4j logging interface
class Program
{
static private string Uri => Environment.GetEnvironmentVariable("NEO4J_URI") ?? "bolt://localhost:7687";
static private string User => Environment.GetEnvironmentVariable("NEO4J_USER") ?? "neo4j";
static private string Password => Environment.GetEnvironmentVariable("NEO4J_PASSWORD") ?? "testingmovies";
static async Task Main(string[] args)
{
try
{
using var driver = GraphDatabase.Driver(Uri, AuthTokens.Basic(User, Password));
var movieRepo = new MovieRepository(driver);
var movie = await movieRepo.FindByTitle("Top Gun");
movie.WriteToConsole();
var movieList = await movieRepo.Search("Matrix");
movieList.ForEach(m => m.WriteToConsole());
var castList = await movieRepo.GetMovieCast("The Matrix");
castList.ForEach(a => a.WriteToConsole());
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}