开发者

Databasename in SQLCE.EntityFramework

开发者 https://www.devze.com 2023-01-23 20:21 出处:网络
Did anyone knows how can i 开发者_如何学Caffect the name of the database in SQLCE.EntityFramework ?Something like this should work, if I understand your question correctly.

Did anyone knows how can i 开发者_如何学Caffect the name of the database in SQLCE.EntityFramework ?


Something like this should work, if I understand your question correctly.

Dim ef As New EntityConnection(New MetadataWorkspace(New String() {"res://*/"}, New Assembly() {Assembly.GetExecutingAssembly()}), **New SqlConnection("Server=yourserver; user id=yourid;password=yourpassword;Database=yourdb;MultipleActiveResultSets=True"))**


dim ctx as New YourContext(ef)


Now i got it ;)

I had to override the constructor of my DbContext Class like this

public class ProductCatalog : DbContext {

public ProductCatalog()
   : base("MyProductCatalog")
{

}

public DbSet<Category> Categories { get; set; }
public DbSet<Product> Products { get; set; }

}

i have found the solution on Link

thanks anyway

0

精彩评论

暂无评论...
验证码 换一张
取 消