RepoDB doesn't merge correct after altering a column

With RepoDB I:

SqlServerBootstrap.Initialize();
using (var cnt = new SqlConnection(connectionString))
{
    cnt.ExecuteNonQuery("DROP TABLE IF EXISTS example");
    cnt.ExecuteNonQuery("CREATE TABLE example(Id int NOT NULL PRIMARY KEY, Data nvarchar(1));");
    cnt.Merge("example", new { Id = 1, Data = "a" });  //Adds a row
    cnt.ExecuteNonQuery("ALTER TABLE example ALTER COLUMN Data nvarchar(10);\n ALTER TABLE example ADD Name nvarchar(10);");
    cnt.Merge("example", new { Id = 1, Data = "Long_word", Name = "A_name" });  //Updates the same row
};

Result: Id = 1 Data = "Lo", Name = NULL

Expected: Id = 1 Data = "Long_word", Name = "A_name"

So RepoDB doesn't know that I have altered two columns. Is there a Flush() or Refresh(), so I can get RepoDB to know that I have made changes? Or can I write into RepoDB, what changes I have made?

1 answer

  • answered 2021-10-21 11:14 Kenneth Bo Christensen

    I got a quick answer at github.

    Flush these ones and it worked:

    DbFieldCache.Flush(); // Remove all the cached DbField
    FieldCache.Flush(); // Remove all the cached DbField
    IdentityCache.Flush(); // Remove all the cached DbField
    PrimaryCache.Flush(); // Remove all the cached DbField
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum