Databasename in SQLCE.EntityFramework
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
精彩评论