Skip to content

Commit f45fee1

Browse files
committed
Update sample and test
1 parent ee4622b commit f45fee1

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎samples/MoviesAppSample/DataAccess/PersonDal.cs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ private ValueTask<bool> SaveMoviePersonsAsync(SQLiteDbContext context, string ta
104104
cancellationToken.ThrowIfCancellationRequested();
105105
return ExecuteInDbContextAsync(context, ctx =>
106106
{
107-
var (adapter, table) = ctx.Connection.SelectForUpdate(tableName, s_relationshipColumns, "WHERE MovieId=@MovieId", true, cancellationToken,
107+
var (adapter, table) = ctx.Connection.SelectForUpdate(tableName, s_relationshipColumns, "WHERE MovieId=@MovieId", cancellationToken,
108108
DbType.Int64.CreateInputParam("@MovieId", movieId));
109109
//table.PrimaryKey = new[] { table.Columns["MovieId"], table.Columns["PersonId"] };
110110
using (adapter)
111+
using (var builder = new SQLiteCommandBuilder(adapter))
111112
{
112113
var processedRows = new HashSet<DataRow>();
113114
foreach (var dto in dtos)

‎tests/InMemoryTest.cs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ public void TestInMemory()
6767
CreateSampleDataBase(conn);
6868
Assert.IsTrue(conn.IsOpen);
6969

70-
var (adapter, table) = conn.SelectForUpdate("SELECT * FROM Sample", true, CancellationToken.None);
70+
var (adapter, table) = conn.SelectForUpdate("SELECT * FROM Sample", CancellationToken.None);
7171
Assert.IsEmpty(table.PrimaryKey);
7272
using (adapter)
73+
using (var builder = new SQLiteCommandBuilder(adapter))
7374
{
7475
for (int i = 0; i < 10; i++)
7576
{
@@ -86,10 +87,11 @@ public void TestInMemory()
8687
var numRead1 = conn.ExecuteReader("SELECT * FROM Sample", (Action<SQLiteDataReader>?)null, CommandBehavior.Default, CancellationToken.None);
8788
Assert.AreEqual(10, numRead1);
8889

89-
(adapter, table) = conn.SelectForUpdate("SELECT * FROM Sample", true, CancellationToken.None);
90+
(adapter, table) = conn.SelectForUpdate("SELECT * FROM Sample", CancellationToken.None);
9091
Assert.HasCount(10, table.Rows);
9192
//table.PrimaryKey = new [] { table.Columns["ID"] };
9293
using (adapter)
94+
using (var builder = new SQLiteCommandBuilder(adapter))
9395
{
9496
int expected = 0;
9597
for (int i = 0; i < table.Rows.Count; i++)

0 commit comments

Comments
 (0)