Specify an SQL username other than dbo in Code First Entity Framework ( C# ASP.NET MVC 3 )

前端 未结 5 1749
梦毁少年i
梦毁少年i 2020-12-31 06:41

I\'m trying to connect to an SQL Server 2008 database in a shared hosting environment from C# from within an ASP.NET MVC 3 application connecting via EF (code first).

<
5条回答
  •  半阙折子戏
    2020-12-31 06:56

    You can specify the schema using a property on the TableAttribute that decorates your entity classes.

    [Table("TableName", Schema = "mySQLUserName")]
    

提交回复
热议问题