我可以通过以下代码在运行时设置实体框架的连接字符串;但我不知道如何添加/更新/删除数据库记录。需要添加/更新/删除的实体是 Products(id,name)。
EntityConnectionStringBuilder ecsb = new EntityConnectionStringBuilder();
ecsb.Metadata = @"res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl";
ecsb.Provider = @"System.Data.VistaDB";
ecsb.ProviderConnectionString = @"data source=test.vdb4;password=password";
using (var context = new DbContext(ecsb.ConnectionString))
{
// how to add new record/update/delete
}