diff --git a/examples/Example/Program.cs b/examples/Example/Program.cs index b2bf082..258f546 100644 --- a/examples/Example/Program.cs +++ b/examples/Example/Program.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading; @@ -24,7 +25,7 @@ public static void Main(string[] args) var changeDataChannel = Channel.CreateUnbounded>>(); _ = Task.Factory.StartNew(async () => { - long lowBoundLsn = await GetStartLsn(connectionString); + var lowBoundLsn = await GetStartLsn(connectionString); while (true) { if (cdcCancellationToken.IsCancellationRequested) @@ -99,7 +100,7 @@ public static void Main(string[] args) cdcCancellation.Cancel(); } - private static async Task GetStartLsn(string connectionString) + private static async Task GetStartLsn(string connectionString) { using var connection = new SqlConnection(connectionString); await connection.OpenAsync(); diff --git a/src/MsSqlCdc/Cdc.cs b/src/MsSqlCdc/Cdc.cs index 62e845a..612557f 100644 --- a/src/MsSqlCdc/Cdc.cs +++ b/src/MsSqlCdc/Cdc.cs @@ -183,7 +183,7 @@ public static async Task MapTimeToLsn( /// Returns the date and time value from the tran_end_time column in the cdc.lsn_time_mapping /// system table for the specified log sequence number (LSN). /// - public static async Task MapLsnToTime(SqlConnection connection, long lsn) + public static async Task MapLsnToTime(SqlConnection connection, BigInteger lsn) { var lsnToTime = await CdcDatabase.MapLsnToTime(connection, lsn); if (!lsnToTime.HasValue) @@ -230,7 +230,7 @@ public static async Task GetMaxLsn(SqlConnection connection) /// An open connection to a MS-SQL database. /// The LSN number that should be used as the point to get the previous LSN. /// Return the high endpoint of the change data capture timeline for any capture instance. - public static async Task GetPreviousLsn(SqlConnection connection, long lsn) + public static async Task GetPreviousLsn(SqlConnection connection, BigInteger lsn) { var previousLsnBytes = await CdcDatabase.DecrementLsn(connection, lsn); if (previousLsnBytes is null) @@ -245,7 +245,7 @@ public static async Task GetPreviousLsn(SqlConnection connection, lo /// An open connection to a MS-SQL database. /// The LSN number that should be used as the point to get the next LSN. /// Get the next log sequence number (LSN) in the sequence based upon the specified LSN. - public static async Task GetNextLsn(SqlConnection connection, long lsn) + public static async Task GetNextLsn(SqlConnection connection, BigInteger lsn) { var nextLsnBytes = await CdcDatabase.IncrementLsn(connection, lsn); if (nextLsnBytes is null) diff --git a/src/MsSqlCdc/CdcDatabase.cs b/src/MsSqlCdc/CdcDatabase.cs index 2b370d7..c2cfe55 100644 --- a/src/MsSqlCdc/CdcDatabase.cs +++ b/src/MsSqlCdc/CdcDatabase.cs @@ -47,7 +47,7 @@ internal static class CdcDatabase return (int?)(await command.ExecuteScalarAsync()); } - public static async Task MapLsnToTime(SqlConnection connection, long lsn) + public static async Task MapLsnToTime(SqlConnection connection, BigInteger lsn) { var sql = "SELECT sys.fn_cdc_map_lsn_to_time(@lsn)"; @@ -87,7 +87,7 @@ internal static class CdcDatabase return (byte[]?)(await command.ExecuteScalarAsync()); } - public static async Task DecrementLsn(SqlConnection connection, long lsn) + public static async Task DecrementLsn(SqlConnection connection, BigInteger lsn) { var sql = "SELECT sys.fn_cdc_decrement_lsn(@lsn)"; using var command = new SqlCommand(sql, connection); @@ -96,7 +96,7 @@ internal static class CdcDatabase return (byte[]?)(await command.ExecuteScalarAsync()); } - public static async Task IncrementLsn(SqlConnection connection, long lsn) + public static async Task IncrementLsn(SqlConnection connection, BigInteger lsn) { var sql = "SELECT sys.fn_cdc_increment_lsn(@lsn)"; using var command = new SqlCommand(sql, connection);