Amir978
Amir978

Reputation: 923

Using DBSet property in an edmx

In my MVC project, I'm using 'Ado.Net entity Data Model' (.edmx) and I've created it by Add--> new --> Data --> 'Ado.Net entity Data Model' from an existing database (I mean it's not 'Code First' nor 'Model First' Approach) but I want to take advantage of 'Defining sets on a derived context DbContext with DbSet properties' like what explained in this tutorial :

public class UnicornsContext : DbContext
{
    public DbSet<UnicornModel> Unicorns { get; set; }
    public DbSet<PrincessModel> Princesses { get; set; }
}

and use: DBSet<ModelName> instead of DbSet<tableName> Is there any way to do that? Which file must be changed?

Upvotes: 0

Views: 1408

Answers (1)

Adam Tuliper
Adam Tuliper

Reputation: 30152

Even if you could I think it would be the wrong approach. Either create a code first, or reverse engineer an existing database into a code first model with the 'entity framework power tools' or simply add new entities to your edmx via the visual designer (as in design the new ones from scratch). Personally I would reverse engineer your existing database and get the great new EF 4.3 code migrations feature.

Upvotes: 1

Related Questions