IServerSession.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Copyright 2017-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using MongoDB.Bson;
  17. namespace MongoDB.Driver
  18. {
  19. /// <summary>
  20. /// The interface for a server session.
  21. /// </summary>
  22. public interface IServerSession : IDisposable
  23. {
  24. // properties
  25. /// <summary>
  26. /// Gets the session Id.
  27. /// </summary>
  28. /// <value>
  29. /// The session Id.
  30. /// </value>
  31. BsonDocument Id { get; }
  32. /// <summary>
  33. /// Gets the time this server session was last used (in UTC).
  34. /// </summary>
  35. /// <value>
  36. /// The time this server session was last used (in UTC).
  37. /// </value>
  38. DateTime? LastUsedAt { get; }
  39. /// <summary>
  40. /// Gets the next transaction number.
  41. /// </summary>
  42. /// <returns>The transaction number.</returns>
  43. [Obsolete("Let the driver handle when to advance the transaction number.")]
  44. long AdvanceTransactionNumber();
  45. // methods
  46. /// <summary>
  47. /// Called by the driver when the session is used (i.e. sent to the server).
  48. /// </summary>
  49. [Obsolete("Let the driver handle tracking when the session was last used.")]
  50. void WasUsed();
  51. }
  52. }