Change Entity Framework database schema map after using code first

后端 未结 2 1660
小鲜肉
小鲜肉 2021-01-23 11:28

I\'ve finished building my blog using EF and Code First.

EF was running against my local SQL Express instance, with [DBO] schema.

Now i want to publish

2条回答
  •  情书的邮戳
    2021-01-23 12:06

    Just for searchers: I am just working with EF5 .NET4.5, and

    [Table("MyTable", "MySchema")]
    

    does not work. Even if VS2012 shows there is an overload which takes 2 parameters, on build it gives the error: 'System.ComponentModel.DataAnnotations.Schema.TableAttribute' does not contain a constructor that takes 2 arguments.

    But the code mapping works just fine.

提交回复
热议问题