The database role for the associated pool. May be null
in which case the default (public) database role is used if fine grained access control
is enabled; otherwise the database role is ignored.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis page provides reference documentation for the \u003ccode\u003eSessionPool.SessionPoolSegmentKey\u003c/code\u003e class within the Google Cloud Spanner v1 API for .NET.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSessionPoolSegmentKey\u003c/code\u003e class is used to define the criteria by which a session pool is divided into segments.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of \u003ccode\u003eSessionPoolSegmentKey\u003c/code\u003e is 5.0.0-beta05, with numerous other versions available, including both beta and stable releases dating back to version 3.5.0.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of \u003ccode\u003eSessionPoolSegmentKey\u003c/code\u003e include \u003ccode\u003eDatabaseName\u003c/code\u003e and \u003ccode\u003eDatabaseRole\u003c/code\u003e, which define the specific database and the role associated with sessions in a pool segment.\u003c/p\u003e\n"],["\u003cp\u003eImportant methods of \u003ccode\u003eSessionPoolSegmentKey\u003c/code\u003e are \u003ccode\u003eCreate\u003c/code\u003e to make an instance of the class with a given database name, and \u003ccode\u003eWithDatabaseRole\u003c/code\u003e to alter the role associated with the segment.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Spanner v1 API - Class SessionPool.SessionPoolSegmentKey (5.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [5.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/5.0.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.6.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.5.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.4.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.4.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.3.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.3.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.2.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.2.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.1.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.1.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [4.0.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/4.0.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.15.1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.15.1/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.14.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.14.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.13.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.13.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.12.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.12.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.11.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.11.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.10.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.10.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.9.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.9.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.8.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.8.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.7.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.7.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.6.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.6.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey)\n- [3.5.0](/dotnet/docs/reference/Google.Cloud.Spanner.V1/3.5.0/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey) \n\n public sealed class SessionPool.SessionPoolSegmentKey : IEquatable\u003cSessionPool.SessionPoolSegmentKey\u003e\n\nReference documentation and code samples for the Google Cloud Spanner v1 API class SessionPool.SessionPoolSegmentKey.\n\nAspects under which a session pool is segmented. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e SessionPool.SessionPoolSegmentKey \n\nImplements\n----------\n\n[IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SessionPool](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionPool)[SessionPoolSegmentKey](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey) \n\nInherited Members\n-----------------\n\n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)\n\nNamespace\n---------\n\n[Google.Cloud.Spanner.V1](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Spanner.V1.dll\n\nProperties\n----------\n\n### DatabaseName\n\n public DatabaseName DatabaseName { get; }\n\nThe database for which sessions are pooled on the associated session pool.\n\n### DatabaseRole\n\n public string DatabaseRole { get; }\n\nThe database role of the sessions pooled on the associated session pool.\n\nMethods\n-------\n\n### Create(DatabaseName)\n\n public static SessionPool.SessionPoolSegmentKey Create(DatabaseName databaseName)\n\nCreates a [SessionPool.SessionPoolSegmentKey](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey) with the given database name.\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WithDatabaseRole(string)\n\n public SessionPool.SessionPoolSegmentKey WithDatabaseRole(string databaseRole)\n\nCreates a [SessionPool.SessionPoolSegmentKey](/dotnet/docs/reference/Google.Cloud.Spanner.V1/latest/Google.Cloud.Spanner.V1.SessionPool.SessionPoolSegmentKey) based on this one but with the given database role."]]