1

I'm trying to update the Simple Authentication from the default MVC 4 Internet Application. My problem is my host provider appends a username as the schema of table I create, so instead of dbo.UserProfile I have a username.UserProfile table.

In the AccountModels.cs file I have updated the TableAttribute to be [Table("username.UserProfile")] instead of just [Table("UserProfile")] which should change the schema used according to this article (http://msdn.microsoft.com/en-us/library/system.data.linq.mapping.tableattribute.aspx).

Though when running the application I still get an Entity Framework error.

System.Data.SqlClient.SqlException (0x80131904): Invalid object name 'dbo.username.UserProfile'.

So it is still appending dbo as the schema... Anyone have any ideas?

Thanks!

1 Answer 1

1

Try [Table("UserProfile", Schema = "username")] -- there's a separate property for the schema.

(I think you might've been getting tripped up from looking at the docs under the wrong namespace; the link you provided is for the System.Data.Linq.Mapping.TableAttribute class, not the one in System.ComponentModel.DataAnnotations.Schema. How dare they use duplicate class names!!)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.