@@ -72,12 +72,21 @@ AssemblyWriteTime = File.GetLastWriteTime(webAssemblyLocation).Ticks.ToString();
7272<!-- snippet: SqlServerTimestamp -->
7373<a id =' snippet-SqlServerTimestamp ' ></a >
7474``` cs
75- select top 1 [End Time ], [Current LSN ]
75+ declare @changeTracking bigint = change_tracking_current_version ();
76+ declare @timeStamp bigint = convert (bigint , @@dbts );
77+
78+ declare @timeResult varchar ;
79+ if (@changeTracking is null )
80+ set @timeResult = cast (@timeStamp as varchar )
81+ else
82+ set @timeResult = cast (@timeStamp as varchar ) + '-' + cast (@changeTracking as varchar )
83+
84+ select top 1 [End Time ] + '-' + @timeResult , [Current LSN ]
7685from fn_dblog ({lsnString }, null )
7786where Operation = 'LOP_COMMIT_XACT'
7887order by [End Time ] desc ;
7988```
80- <sup ><a href =' /src/Delta/DeltaExtensions_Sql.cs#L51-L56 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-SqlServerTimestamp ' title =' Start of snippet ' >anchor</a ></sup >
89+ <sup ><a href =' /src/Delta/DeltaExtensions_Sql.cs#L51-L65 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-SqlServerTimestamp ' title =' Start of snippet ' >anchor</a ></sup >
8190<!-- endSnippet -->
8291
8392
@@ -320,7 +329,7 @@ var application = webApplicationBuilder.Build();
320329application .UseDelta (
321330 getConnection : httpContext => httpContext .RequestServices .GetRequiredService <SqlConnection >());
322331```
323- <sup ><a href =' /src/DeltaTests/Usage.cs#L293-L299 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CustomDiscoveryConnection ' title =' Start of snippet ' >anchor</a ></sup >
332+ <sup ><a href =' /src/DeltaTests/Usage.cs#L291-L297 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CustomDiscoveryConnection ' title =' Start of snippet ' >anchor</a ></sup >
324333<!-- endSnippet -->
325334
326335To use custom connection and transaction discovery:
@@ -338,7 +347,7 @@ webApplication.UseDelta(
338347 return new (connection , transaction );
339348 });
340349```
341- <sup ><a href =' /src/DeltaTests/Usage.cs#L304-L316 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CustomDiscoveryConnectionAndTransaction ' title =' Start of snippet ' >anchor</a ></sup >
350+ <sup ><a href =' /src/DeltaTests/Usage.cs#L302-L314 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-CustomDiscoveryConnectionAndTransaction ' title =' Start of snippet ' >anchor</a ></sup >
342351<!-- endSnippet -->
343352
344353
@@ -525,7 +534,7 @@ Nuget: [Delta.SqlServer](https://www.nuget.org/packages/Delta.SqlServer)
525534``` cs
526535var timeStamp = await sqlConnection .GetLastTimeStamp ();
527536```
528- <sup ><a href =' /src/DeltaTests/Usage.cs#L155-L159 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GetLastTimeStampSqlConnection ' title =' Start of snippet ' >anchor</a ></sup >
537+ <sup ><a href =' /src/DeltaTests/Usage.cs#L153-L157 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GetLastTimeStampSqlConnection ' title =' Start of snippet ' >anchor</a ></sup >
529538<!-- endSnippet -->
530539
531540
@@ -553,7 +562,7 @@ foreach (var db in trackedDatabases)
553562 Trace .WriteLine (db );
554563}
555564```
556- <sup ><a href =' /src/DeltaTests/Usage.cs#L191-L199 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GetDatabasesWithTracking ' title =' Start of snippet ' >anchor</a ></sup >
565+ <sup ><a href =' /src/DeltaTests/Usage.cs#L189-L197 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GetDatabasesWithTracking ' title =' Start of snippet ' >anchor</a ></sup >
557566<!-- endSnippet -->
558567
559568Uses the following SQL:
@@ -583,7 +592,7 @@ foreach (var db in trackedTables)
583592 Trace .WriteLine (db );
584593}
585594```
586- <sup ><a href =' /src/DeltaTests/Usage.cs#L217-L225 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GetTrackedTables ' title =' Start of snippet ' >anchor</a ></sup >
595+ <sup ><a href =' /src/DeltaTests/Usage.cs#L215-L223 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-GetTrackedTables ' title =' Start of snippet ' >anchor</a ></sup >
587596<!-- endSnippet -->
588597
589598Uses the following SQL:
@@ -608,7 +617,7 @@ Determine if change tracking is enabled for a database.
608617```cs
609618var isTrackingEnabled = await sqlConnection .IsTrackingEnabled ();
610619```
611- <sup ><a href =' /src/DeltaTests/Usage.cs#L282-L286 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-IsTrackingEnabled ' title =' Start of snippet ' >anchor</a ></sup >
620+ <sup ><a href =' /src/DeltaTests/Usage.cs#L280-L284 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-IsTrackingEnabled ' title =' Start of snippet ' >anchor</a ></sup >
612621<!-- endSnippet -->
613622
614623Uses the following SQL:
@@ -635,7 +644,7 @@ Enable change tracking for a database.
635644```cs
636645await sqlConnection .EnableTracking ();
637646```
638- <sup ><a href =' /src/DeltaTests/Usage.cs#L276-L280 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-EnableTracking ' title =' Start of snippet ' >anchor</a ></sup >
647+ <sup ><a href =' /src/DeltaTests/Usage.cs#L274-L278 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-EnableTracking ' title =' Start of snippet ' >anchor</a ></sup >
639648<!-- endSnippet -->
640649
641650Uses the following SQL:
@@ -663,7 +672,7 @@ Disable change tracking for a database and all tables within that database.
663672```cs
664673await sqlConnection .DisableTracking ();
665674```
666- <sup ><a href =' /src/DeltaTests/Usage.cs#L261-L265 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-DisableTracking ' title =' Start of snippet ' >anchor</a ></sup >
675+ <sup ><a href =' /src/DeltaTests/Usage.cs#L259-L263 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-DisableTracking ' title =' Start of snippet ' >anchor</a ></sup >
667676<!-- endSnippet -->
668677
669678Uses the following SQL:
@@ -700,7 +709,7 @@ Enables change tracking for all tables listed, and disables change tracking for
700709``` cs
701710await sqlConnection .SetTrackedTables ([" Companies" ]);
702711```
703- <sup ><a href =' /src/DeltaTests/Usage.cs#L211-L215 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-SetTrackedTables ' title =' Start of snippet ' >anchor</a ></sup >
712+ <sup ><a href =' /src/DeltaTests/Usage.cs#L209-L213 ' title =' Snippet source file ' >snippet source</a > | <a href =' #snippet-SetTrackedTables ' title =' Start of snippet ' >anchor</a ></sup >
704713<!-- endSnippet -->
705714
706715Uses the following SQL:
0 commit comments