@@ -28,13 +28,58 @@ namespace Neo4j.Driver.V1
2828 public static class GraphDatabase
2929 {
3030 internal const int DefaultBoltPort = 7687 ;
31+
3132 /// <summary>
3233 /// Returns a driver for a Neo4j instance with default configuration settings.
3334 /// </summary>
3435 /// <param name="uri">
35- /// The <see cref="Uri" /> to the Neo4j instance. Should be in the form
36- /// <c>bolt://<server location>:<port></c>. If <c>port</c> is not supplied the default of <c>7687</c> will
36+ /// The URI to the Neo4j instance. Should be in the form
37+ /// <c>protocol://<server location>:<port></c>.
38+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
3739 /// be used.
40+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
41+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
42+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
43+ /// </param>
44+ /// <returns>A new <see cref="IDriver" /> instance specified by the <paramref name="uri" />.</returns>
45+ /// <remarks>Ensure you provide the protocol for the <paramref name="uri" />.</remarks>
46+ /// <exception cref="ArgumentNullException">Thrown if <paramref name="uri" /> is <c>null</c>.</exception>
47+ public static IDriver Driver ( string uri )
48+ {
49+ return Driver ( new Uri ( uri ) ) ;
50+ }
51+
52+ /// <summary>
53+ /// Returns a driver for a Neo4j instance with default configuration settings.
54+ /// </summary>
55+ /// <param name="uri">
56+ /// The URI to the Neo4j instance. Should be in the form
57+ /// <c>protocol://<server location>:<port></c>.
58+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
59+ /// be used.
60+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
61+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
62+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
63+ /// </param>
64+ /// <returns>A new <see cref="IDriver" /> instance specified by the <paramref name="uri" />.</returns>
65+ /// <remarks>Ensure you provide the protocol for the <paramref name="uri" />.</remarks>
66+ /// <exception cref="ArgumentNullException">Thrown if <paramref name="uri" /> is <c>null</c>.</exception>
67+ public static IDriver Driver ( Uri uri )
68+ {
69+ return Driver ( uri , ( Config ) null ) ;
70+ }
71+
72+ /// <summary>
73+ /// Returns a driver for a Neo4j instance with custom configuration.
74+ /// </summary>
75+ /// <param name="uri">
76+ /// The URI to the Neo4j instance. Should be in the form
77+ /// <c>protocol://<server location>:<port></c>.
78+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
79+ /// be used.
80+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
81+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
82+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
3883 /// </param>
3984 /// <param name="config">
4085 /// Configuration for the driver instance to use, if <c>null</c> <see cref="Config.DefaultConfig" />
@@ -43,18 +88,22 @@ public static class GraphDatabase
4388 /// <returns>A new <see cref="IDriver" /> instance specified by the <paramref name="uri" />.</returns>
4489 /// <remarks>Ensure you provide the protocol for the <paramref name="uri" />.</remarks>
4590 /// <exception cref="ArgumentNullException">Thrown if <paramref name="uri" /> is <c>null</c>.</exception>
46- public static IDriver Driver ( Uri uri , Config config = null )
91+ public static IDriver Driver ( string uri , Config config )
4792 {
48- return Driver ( uri , AuthTokens . None , config ?? Config . DefaultConfig ) ;
93+ return Driver ( new Uri ( uri ) , config ) ;
4994 }
5095
5196 /// <summary>
52- /// Returns a driver for a Neo4j instance with default configuration settings .
97+ /// Returns a driver for a Neo4j instance with custom configuration.
5398 /// </summary>
5499 /// <param name="uri">
55100 /// The URI to the Neo4j instance. Should be in the form
56- /// <c>bolt://<server location>:<port></c>. If <c>port</c> is not supplied the default of <c>7687</c> will
101+ /// <c>protocol://<server location>:<port></c>.
102+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
57103 /// be used.
104+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
105+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
106+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
58107 /// </param>
59108 /// <param name="config">
60109 /// Configuration for the driver instance to use, if <c>null</c> <see cref="Config.DefaultConfig" />
@@ -63,27 +112,74 @@ public static IDriver Driver(Uri uri, Config config = null)
63112 /// <returns>A new <see cref="IDriver" /> instance specified by the <paramref name="uri" />.</returns>
64113 /// <remarks>Ensure you provide the protocol for the <paramref name="uri" />.</remarks>
65114 /// <exception cref="ArgumentNullException">Thrown if <paramref name="uri" /> is <c>null</c>.</exception>
66- public static IDriver Driver ( string uri , Config config = null )
115+ public static IDriver Driver ( Uri uri , Config config )
67116 {
68- return Driver ( new Uri ( uri ) , AuthTokens . None , config ?? Config . DefaultConfig ) ;
117+ return Driver ( uri , AuthTokens . None , config ) ;
118+ }
119+
120+ /// <summary>
121+ /// Returns a driver for a Neo4j instance with default configuration settings.
122+ /// </summary>
123+ /// <param name="uri">
124+ /// The URI to the Neo4j instance. Should be in the form
125+ /// <c>protocol://<server location>:<port></c>.
126+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
127+ /// be used.
128+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
129+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
130+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
131+ /// </param>
132+ /// <param name="authToken">Authentication to use, <see cref="AuthTokens" />.</param>
133+ /// <returns>A new <see cref="IDriver" /> instance specified by the <paramref name="uri" />.</returns>
134+ /// <remarks>Ensure you provide the protocol for the <paramref name="uri" />.</remarks>
135+ /// <exception cref="ArgumentNullException">Thrown if <paramref name="uri" /> is <c>null</c>.</exception>
136+ public static IDriver Driver ( string uri , IAuthToken authToken )
137+ {
138+ return Driver ( new Uri ( uri ) , authToken ) ;
139+ }
140+
141+ /// <summary>
142+ /// Returns a driver for a Neo4j instance with default configuration settings.
143+ /// </summary>
144+ /// <param name="uri">
145+ /// The URI to the Neo4j instance. Should be in the form
146+ /// <c>protocol://<server location>:<port></c>.
147+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
148+ /// be used.
149+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
150+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
151+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
152+ /// </param>
153+ /// <param name="authToken">Authentication to use, <see cref="AuthTokens" />.</param>
154+ /// <returns>A new <see cref="IDriver" /> instance specified by the <paramref name="uri" />.</returns>
155+ /// <remarks>Ensure you provide the protocol for the <paramref name="uri" />.</remarks>
156+ /// <exception cref="ArgumentNullException">Thrown if <paramref name="uri" /> is <c>null</c>.</exception>
157+ public static IDriver Driver ( Uri uri , IAuthToken authToken )
158+ {
159+ return Driver ( uri , authToken , null ) ;
69160 }
70161
71162 /// <summary>
72163 /// Returns a driver for a Neo4j instance with custom configuration.
73164 /// </summary>
74165 /// <param name="uri">
75- /// The <see cref="Uri" /> to the Neo4j instance. Should be in the form
76- /// <c>bolt://<server location>:<port></c>. If <c>port</c> is not supplied the default of <c>7687</c> will
77- /// be used.</param>
166+ /// The URI to the Neo4j instance. Should be in the form
167+ /// <c>protocol://<server location>:<port></c>.
168+ /// If <c>port</c> is not supplied the default of <c>7687</c> will
169+ /// be used.
170+ /// The supported protocols in URI could either be <c>bolt</c> or <c>bolt+routing</c>.
171+ /// The protocol <c>bolt</c> should be used when creating a driver connecting to the Neo4j instance directly.
172+ /// The protocol <c>bolt+routing</c> should be used when creating a driver with built-in routing.
173+ /// </param>
78174 /// <param name="authToken">Authentication to use, <see cref="AuthTokens" />.</param>
79175 /// <param name="config">
80176 /// Configuration for the driver instance to use, if <c>null</c> <see cref="Config.DefaultConfig" />
81177 /// is used.
82178 /// </param>
83179 /// <returns>A new driver to the database instance specified by the <paramref name="uri"/>.</returns>
84- public static IDriver Driver ( string uri , IAuthToken authToken , Config config = null )
180+ public static IDriver Driver ( string uri , IAuthToken authToken , Config config )
85181 {
86- return Driver ( new Uri ( uri ) , authToken , config ?? Config . DefaultConfig ) ;
182+ return Driver ( new Uri ( uri ) , authToken , config ) ;
87183 }
88184
89185 /// <summary>
@@ -99,8 +195,10 @@ public static IDriver Driver(string uri, IAuthToken authToken, Config config = n
99195 /// is used.
100196 /// </param>
101197 /// <returns>A new driver to the database instance specified by the <paramref name="uri"/>.</returns>
102- public static IDriver Driver ( Uri uri , IAuthToken authToken , Config config = null )
198+ public static IDriver Driver ( Uri uri , IAuthToken authToken , Config config )
103199 {
200+ Throw . ArgumentNullException . IfNull ( uri , nameof ( uri ) ) ;
201+ Throw . ArgumentNullException . IfNull ( authToken , nameof ( authToken ) ) ;
104202 config = config ?? Config . DefaultConfig ;
105203
106204 var parsedUri = uri . ParseUri ( DefaultBoltPort ) ;
0 commit comments