0

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?

Kenneth Bo Christensen
  • 2,256
  • 2
  • 18
  • 21

1 Answers1

0

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
Kenneth Bo Christensen
  • 2,256
  • 2
  • 18
  • 21