You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*:warning:***Breaking Change*** - CosmosDB partition-related parameters are ignored. All containers use `/id` as the partition path now. Using an existing container with a different partition key path will result in exceptions.
41
41
> The original design around partition use in the CosmosDB provider was influenced by experience with the older SQL partition paradigms. There was an effort to enable them for scalability, but keep them reasonable for managability. In reality, CosmosDB encourages the use of as many "logical" partitions as can be used so long as they make sense. The complexity of managing and scaling is all handled magically by CosmosDB.
42
42
>
43
43
> The most logical partition field for session state is the session ID. The CosmosDB provider has been updated to alway use `"/id"` as the partition key path with the full session ID as the partition value. Pre-existing containers that use a different partition key path (which is any that opted into using partitions previously) will need to migrate to a container that uses `"/id"` as the partition key path. The data is all still good - although, the old partition key path can be dropped when migrating. There is unfortunately no way to simply update the partition key path on an existing container right now. [This blog post](https://devblogs.microsoft.com/cosmosdb/how-to-change-your-partition-key/) is a guide for migrating to a new container with the correct partition key path.
44
+
*:warning:***Action Required*** Sql provider `RepositoryType` - This new setting provides a little more flexibility for repository configuration beyond a single boolean for in-memory optimized tables. Possible values are `SqlServer|InMemory|InMemoryDurable|FrameworkCompat`. Read about what each configuration is at our [SqlSessionStateProviderAsync](docs/SqlSessionStateProviderAsync.md) doc page.
45
+
46
+
> The mechanics of nuget package upgrade results in removing old elements and re-adding the boiler-plate elements in configuration. To restore In-Memory functionality, set 'RepositoryType' to `InMemory`. To continue using an existing non-memory-optimized table without stored procedures, set 'RespositoryType' to `FrameworkCompat`. The recommendation is to update to the new table schema and use stored procedures with `SqlServer`, but this will ignore existing sessions in previously existing tables.
47
+
* The Sql provider's `UseInMemoryTable` is deprecated. It will continue to be respected in the absence of `RepositoryType`, but is overridden by that setting if given.
48
+
* Sql provider `SessionTableName` - A new setting that allows users to target a specific table in their database rather than being forced to use the default table names.
44
49
* CosmosDB `collectionId` is now `containerId` in keeping with the updated terminology from the CosmosDB offering. Please use the updated parameter name when configuring your provider. (The old name will continue to work just the same.)
45
50
* CosmosDB `connectionProtocol` is obsolete. It will not cause errors to have it in configuration, but it is ignored. The current [CosmosDB SDK chooses the protocol based on connection mode](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/sdk-connection-modes).
The old in-box SQL provider allowed for applications to choose between three data configurations by using the `-sstype` argument to `aspnet_regsql.exe`. Those types were <u>*p*</u>ermanent, <u>*t*</u>emporary, or <u>*c*</u>ustom. The difference between all three is simply the database and table name used by `aspnet_regsql.exe` and the application at runtime.
20
+
* With the permanent option, session state would be stored in a hard-coded well-known table name in the database specified by the connection string. The table schema and data are "permanent" in this setup because they survive SQL server reboot.
21
+
* With the temporary option, session state would be stored in a hard-coded well-known table name in the "tempdb" database on the SQL Server specified in the connection string. The "tempdb" database gets cleared upon SQL server reboot, so the data is not kept. The table schema and stored procedures are also cleared in this scenario, but there is a startup procedure that gets registered to re-create session state tables and stored procedures.
22
+
* With the custom option, session state would be stored in a table name given by the developer/administrator. The stored procedures created in the database work against that custom table name.
23
+
24
+
With this new provider, `aspnet_regsql.exe` is no longer required. (Although, compatibility with stores created by 'aspnet_regsql.exe' can be found when using 'RepositoryType=FrameworkCompat'.) When using a `SqlServer` 'RepositoryType' the provider will automatically create tables and stored procedures if they don't already exist. By default, that table name is "hard-coded and well-known" - though it has changed from previous versions to avoid inadvertent compatibility problems. You can change that table name by using the 'SessionTableName' attribute on the provider. Whether or not data is 'temporary' or 'permanent' in this type of repository depends entirely on the connection string used. If the connection string indicates using "tempdb", then the data will be temporary. If it indicates a non-temporary initial database, then the data will survive SQL reboots.
25
+
26
+
When using a Memory-Optimized 'RepositoryType' however, data durability is determined by the optimized table schema. Thus, the provider needs to know what settings to apply to any table it creates. If you want permanent data that survives SQL Server reboots, you must use `InMemoryDurable`.
27
+
15
28
## Settings for Microsoft.AspNet.SessionState.SqlSessionStateProviderAsync
16
-
1.*UseInMemoryTable* - Indicates whether to use Sql server 2016 In-Memory OLTP for sessionstate. You can find more details about using In-memory table for sessionstate [on this blog](https://blogs.msdn.microsoft.com/sqlcat/2016/10/26/how-bwin-is-using-sql-server-2016-in-memory-oltp-to-achieve-unprecedented-performance-and-scale/).
29
+
1.*RepositoryType* - One of four values. The default is 'FrameworkCompat' for compatibility reasons - unless the deprecated 'UseInMemoryTable' is also set to true, then the default repository type becomes 'InMemory'.
30
+
*`SqlServer` - Use this option to use a regular SQL server configuration for a fresh deployment. This configuration will create a session table and associated stored procedures if they don't already exist. (*Note* - the session table expected/created in by this repository type uses a different data type for storing state, and is thus incompatible with the 1.1 release of this provider.)
31
+
*`InMemory` - Use this option to leverage "[In-Memory Optimized Tables](https://learn.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/introduction-to-memory-optimized-tables?view=sql-server-ver16)" with "[Natively Compiled Stored Procedures](https://learn.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/a-guide-to-query-processing-for-memory-optimized-tables?view=sql-server-ver16)". New in version 2.0, we create natively compiled stored procedures to go along with the memory-optimized table for an additional performance boost. (V1.1 did not use stored procedures at all.) Tables are durable, but the data is not (`SCHEMA_ONLY`) and will be lost on SQL Server restarts.
32
+
*`InMemoryDurable` - The same as above, except with a `SCHEMA_AND_DATA` durable table so session data survives a SQL Server restart.
33
+
*`FrameworkCompat` - This mode was introduced to use existing session state databases that were provisioned by `aspnet_regsql.exe`. As such, it does not create any new tables or stored procedures. It does leverage the same stored procedures that are used by the in-box SQL Session State provider.
34
+
35
+
This compat configuration ***also*** handles going against a database that was previously configured by V1.1 of these providers, since the current table schema is not fully compatible with the 1.1 table schema. When working against a 1.1-deployed session table, this repository continues to use raw SQL statements instead of stored procedures just like the V1.1 provider did.
36
+
37
+
The provider automatically decides between Framework and V1.1 compat modes in this configuration.
38
+
39
+
2.*SessionTableName* - The provider now allows the flexibility to use a particular table name for storing session instead of always using the hard-coded default.
40
+
41
+
3.*MaxRetryNumber* - The maximum number of retrying executing sql query to read/write sessionstate data from/to Sql server. The default value is 10.
17
42
18
-
2.*MaxRetryNumber* - The maximum number of retrying executing sql query to read/write sessionstate data from/to Sql server. The default value is 10.
43
+
4.*RetryInterval* - The interval between the retry of executing sql query. The default value is 0.001 sec for in-memorytable mode. Otherwise the default value is 1 sec.
19
44
20
-
3.*RetryInterval* - The interval between the retry of executing sql query. The default value is 0.001 sec for in-memorytable mode. Otherwise the default value is 1 sec.
45
+
5.**[Deprecated]***UseInMemoryTable* - In the absence of a value for `RepositoryType`, this setting will be used to determine whether to use Sql server 2016 In-Memory OLTP for sessionstate. However, if `RepositoryType` is specified, that setting takes priority. You can find more details about using In-memory table for sessionstate [on this blog](https://blogs.msdn.microsoft.com/sqlcat/2016/10/26/how-bwin-is-using-sql-server-2016-in-memory-oltp-to-achieve-unprecedented-performance-and-scale/).
<value>The table '{0}' is compatible with current repositories. Use the '{1}' repositoryType instead with the 'SessionTableName' attribute if applicable.</value>
0 commit comments