@@ -35,7 +35,7 @@ namespace Xtensive.Orm
3535 /// <code lang="cs" source="..\Xtensive.Orm\Xtensive.Orm.Manual\DomainAndSession\DomainAndSessionSample.cs" region="Domain sample"></code>
3636 /// </sample>
3737 [ UsedImplicitly ( ImplicitUseTargetFlags . WithMembers ) ]
38- public sealed class Domain : IDisposable , IHasExtensions
38+ public sealed class Domain : IDisposable , IHasExtensions , ISessionSource
3939 {
4040 private readonly object disposeGuard = new object ( ) ;
4141 private readonly object singleConnectionGuard = new object ( ) ;
@@ -116,13 +116,13 @@ public static Domain Demand()
116116 /// }
117117 /// </code></sample>
118118 /// <exception cref="ArgumentException"><see cref="StorageNode"/> with given identifier does not exist.</exception>
119- public ISelectedStorageNode SelectStorageNode ( [ NotNull ] string storageNodeId )
119+ public ISessionSource SelectStorageNode ( [ NotNull ] string storageNodeId )
120120 {
121121 var node = StorageNodeManager . GetNode ( storageNodeId ) ;
122122 if ( node == null ) {
123123 throw new ArgumentException ( string . Format ( Strings . ExStorageNodeWithIdXIsNotFound , storageNodeId ) ) ;
124124 }
125- return new SelectedStorageNode ( this , node ) ;
125+ return node ;
126126 }
127127
128128 #region Private / internal members
@@ -284,22 +284,6 @@ internal Session OpenSessionInternal(SessionConfiguration configuration, Storage
284284 return session ;
285285 }
286286
287- /// <summary>
288- /// Opens new <see cref="Session"/> with default <see cref="SessionConfiguration"/> asynchronously.
289- /// </summary>
290- /// <returns>A task representing the asynchronous operation.</returns>
291- /// <sample><code>
292- /// using (var session = await Domain.OpenSessionAsync()) {
293- /// // work with persistent objects here.
294- /// }
295- /// </code></sample>
296- /// <seealso cref="Session"/>
297- public Task < Session > OpenSessionAsync ( )
298- {
299- var configuration = Configuration . Sessions . Default ;
300- return OpenSessionAsync ( configuration , CancellationToken . None ) ;
301- }
302-
303287 /// <summary>
304288 /// Opens new <see cref="Session"/> with default <see cref="SessionConfiguration"/> asynchronously.
305289 /// </summary>
@@ -312,27 +296,12 @@ public Task<Session> OpenSessionAsync()
312296 /// }
313297 /// </code></sample>
314298 /// <seealso cref="Session"/>
315- public Task < Session > OpenSessionAsync ( CancellationToken cancellationToken )
299+ public Task < Session > OpenSessionAsync ( CancellationToken cancellationToken = default )
316300 {
317301 var configuration = Configuration . Sessions . Default ;
318302 return OpenSessionAsync ( configuration , cancellationToken ) ;
319303 }
320304
321- /// <summary>
322- /// Opens new <see cref="Session"/> of specified <see cref="SessionType"/> asynchronously.
323- /// </summary>
324- /// <param name="type">The type of session.</param>
325- /// <returns>A task representing the asynchronous operation.</returns>
326- /// <sample><code>
327- /// using (var session = await domain.OpenSessionAsync(sessionType)) {
328- /// // work with persistent objects here.
329- /// }
330- /// </code></sample>
331- public Task < Session > OpenSessionAsync ( SessionType type )
332- {
333- return OpenSessionAsync ( type , CancellationToken . None ) ;
334- }
335-
336305 /// <summary>
337306 /// Opens new <see cref="Session"/> of specified <see cref="SessionType"/> asynchronously.
338307 /// </summary>
@@ -345,7 +314,7 @@ public Task<Session> OpenSessionAsync(SessionType type)
345314 /// // work with persistent objects here.
346315 /// }
347316 /// </code></sample>
348- public Task < Session > OpenSessionAsync ( SessionType type , CancellationToken cancellationToken )
317+ public Task < Session > OpenSessionAsync ( SessionType type , CancellationToken cancellationToken = default )
349318 {
350319 cancellationToken . ThrowIfCancellationRequested ( ) ;
351320 switch ( type ) {
@@ -362,22 +331,6 @@ public Task<Session> OpenSessionAsync(SessionType type, CancellationToken cancel
362331 }
363332 }
364333
365- /// <summary>
366- /// Opens new <see cref="Session"/> with specified <see cref="SessionConfiguration"/> asynchronously.
367- /// </summary>
368- /// <param name="configuration">The session configuration.</param>
369- /// <returns>A task representing the asynchronous operation.</returns>
370- /// <sample><code>
371- /// using (var session = await domain.OpenSessionAsync(configuration)) {
372- /// // work with persistent objects here
373- /// }
374- /// </code></sample>
375- /// <seealso cref="Session"/>
376- public Task < Session > OpenSessionAsync ( SessionConfiguration configuration )
377- {
378- return OpenSessionAsync ( configuration , CancellationToken . None ) ;
379- }
380-
381334 /// <summary>
382335 /// Opens new <see cref="Session"/> with specified <see cref="SessionConfiguration"/> asynchronously.
383336 /// </summary>
@@ -391,7 +344,7 @@ public Task<Session> OpenSessionAsync(SessionConfiguration configuration)
391344 /// }
392345 /// </code></sample>
393346 /// <seealso cref="Session"/>
394- public Task < Session > OpenSessionAsync ( SessionConfiguration configuration , CancellationToken cancellationToken )
347+ public Task < Session > OpenSessionAsync ( SessionConfiguration configuration , CancellationToken cancellationToken = default )
395348 {
396349 return OpenSessionInternalAsync ( configuration , null ,
397350 configuration . Supports ( SessionOptions . AutoActivation ) , cancellationToken ) ;
0 commit comments