Entity Framework migration from MySQL to SQL Server and the Table names missing "dbo"

c# entity-framework-6 sql-server

Question

I'm looking after a functioning C# project that requiresEntity Framewwork 6 do the ORM. I must now move the database fromMySQL to SQL Server . I've been able to build the program so far by changing the.edmx (For instance, I modified theProvider from MySql.Data.MySqlClient to System.Data.SqlClient and ProviderManifestToken from 5.6 to 2008 . Additionally, I had to alter a few data types (for instance, from double to float) in the SSDL content.

Now, whenever I do a straightforwardLINQ inquire about theObjectContext -derived context, e.g.

var query = from data in context.user select data;
var users = query.ToArray();                    

I see an error message that reads, "Invalid object name'MYDBNAME.user'."

Evidently, there is no ".dbo," hence the translated SQL query should be

select * from MYDBNAME.dbo.user

in place of

select * from MYDBNAME.user

However, I'm not sure how I can tell EF to include the ".dbo". Is there a setting or choice to accomplish that?

1
0
10/18/2018 6:20:11 AM

Popular Answer

It's a really straightforward and uncomplicated process. You must do the actions listed below. I'm hoping it will be successful for you.

  1. From that MYSQL database, you must create all of your MSSQL Server schema.

  2. Once your MSSQL Server database schema is complete

  3. The Entity Framework will then automatically create all of your models and DB context from the database if you choose the database first technique.

  4. Database First Approach: How to Generate DB Models and Context First Data Base EF

  5. The database and queries may then be used with Linq. Thanks

1
10/18/2018 6:45:23 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow