moris62
moris62

Reputation: 1045

HasDefaultSchema is not recognized even with System.Data.Entity on the namespace

I want create a dbCotext and model according to my schema and view but I get the error:

public CarContext() : base(nameOrConnectionString: "LTtest") { }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.HasDefaultSchema("wpv");   
    base.OnModelCreating(modelBuilder);
}
public DbSet<v_run_tt> v_run { get; set; } 

I need to write schema name, is there any other way? I'm using PostgreSQL and entityframework 4

Upvotes: 0

Views: 1034

Answers (1)

Lo&#239;cR
Lo&#239;cR

Reputation: 5039

The HasDefaultSchema is only available in EFG 6+ ( https://msdn.microsoft.com/en-us/library/system.data.entity.dbmodelbuilder.hasdefaultschema(v=vs.113).aspx ).

However, you can use the second parameter of toTable to specify the schema name. toTable("tableName", "schemaName"); https://msdn.microsoft.com/en-us/library/gg679488(v=vs.113).aspx

Upvotes: 1

Related Questions