Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create a SQL Server table within a Schema using EntityFramework Code-First?

Is it possible to create, not just a table with EF CodeFirst, but also have the table be part of a schema?

like image 477
Ian Warburton Avatar asked Dec 04 '25 11:12

Ian Warburton


1 Answers

You can specify the schema with data annotations as follows

[Table("MyTable", "MySchema")]
public class MyEntity
{

}

Or with fluent API

modelMoulder.Entity<MyEntity>().ToTable("MyTable", "MySchema");
like image 199
Eranga Avatar answered Dec 07 '25 17:12

Eranga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!