コード例 #1
0
        public static NeoConfiguration LoadConfigurationFile(string filepath)
        {
            NeoConfiguration conf = new NeoConfiguration();

            using (StreamReader reader = File.OpenText(filepath))
            {
                JsonSerializer serializer = new JsonSerializer();
                conf = (NeoConfiguration)serializer.Deserialize(reader, typeof(NeoConfiguration));
            }
            return(conf);
        }
コード例 #2
0
 public static IDriver ConnectToNeo(NeoConfiguration config, Config neo4jconfig)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(config.DB_Password) || string.IsNullOrWhiteSpace(config.DB_Username))
         {
             return(GraphDatabase.Driver(config.DB_URI, neo4jconfig));
         }
         else
         {
             return(GraphDatabase.Driver(config.DB_URI, AuthTokens.Basic(config.DB_Username, config.DB_Password), neo4jconfig));
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("Error connecting to Neo4j: " + e.Message);
         Environment.Exit(1002);
     }
     return(null);
 }