Search code examples
c#sql-serverentity-frameworklinked-server

Entity Framework with Linked Database and SQL Views


I am trying to use Entity Framework 6.1.1 in Visual Studio 2013 with C#. I am using SQL Server 2012 in the back end. I have tested a regular SQL Server database which works fine. I used the Database First design pathway. I have a database that is actually a Linked Server in Microsoft SQL. The back end of the linked server is SQLite. The linked server is interacted with via several views in a regular Microsoft SQL database. I do not have to write or modify data in the linked server in any way.

I cannot get Database First to build a model of this database with the views, regardless of what I try. I have tried to use Code First to manually write an interface with the database, without any success.

Is it possible to get Entity Framework to talk to this database? How can I do so?


Solution

  • Okay, if anyone later finds this and has the same problem, I resolved this by using Code First and manually creating Entities with names to match the SQL tables and variables with names to match the fields. This worked fine and I could even use navigation properties and all worked great.