Kishore Kumar
Kishore Kumar

Reputation: 12864

LinqToSql and Entity Framework or ADO.Net?

I was using ADO.Net in my .Net projects from the past few years. Now I started using Linq2Sql and Entity Framework.

When using ADO.Net application my client should have SQL Server in their system to access the database file.

But some one has told me that Linq2Sql and Entity Framework doesn't need SQL Server on the client, it just need the .mdf file to access the database.

Because in LinqToSql we give the connection as the path of .mdf file

DataContext dc= new DataContext("path to database file");

Is it true?

Please explain me all the things.

Upvotes: 0

Views: 351

Answers (3)

cynic
cynic

Reputation: 5405

You're thinking User Instances, replaced by LocalDB in SQL Server 2012. This has nothing to do specifically with Linq to SQL or Entity Framework. And all these options require installing SQL Server on the client machine.

Upvotes: 0

Min Min
Min Min

Reputation: 6218

It is not related with ADO.net or LINQ2SQL or EntityFramework. It is related with which Database Edition you are using. And I don't think you can use .mdf file without Installing SQL Database Server from any of above data access technology.

May be you are referring to SQL Compact Edition (.sdf). Which you can use without installing SQL Server. (You can also connect with ADO.net to .sdf database file)

myConnection = new SqlCeConnection("Data Source=\\Mobile\\Northwind.sdf;");
myConnection.Open();

[SQL Compact Edition]

Upvotes: 1

Haris Hasan
Haris Hasan

Reputation: 30097

I highly doubt that you can directly use ,mdf file without SQL Server because

  1. Database transactions are not simply file reading and writing that can be done directly against .mdf file.

  2. LINQ to SQL queries are first converted into SQL and then executed. Without SQL Server engine, how these SQL queries would be interpreted

Upvotes: 3

Related Questions