问题描述
在互联网上看到很多东西之后,我没有发现两种文件类型之间有任何解释: .mdf
和 .sdf
。 .sdf
将是SQL Server的紧凑版本( .mdf
)我相信。仍然他们看起来完全不一样。
已经遵循了关于msdn的两个教程,即和。两者都使用 .sdf
。
部分引用():'首先应该是| DataDirectory | ASPNETDBContext.mdf(注意扩展差异)。你的应用程序...'
这两个教程都有连接字符串到 .sdf
,即:
< add name =MovieDBContext
connectionString =Data Source = | DataDirectory | Movies.sdf
providerName =System.Data.SqlServerCe.4.0
/>
< add name =MusicStoreEntities
connectionString =Data Source = | DataDirectory | MvcMusicStore.sdf
providerName =System.Data.SqlServerCe.4.0
/>
问题:
我的问题是什么,什么时候使用?
在Windows中流行的SQL Server Compact(sdf文件)用于存储一些数据的电话(小数据数据),也可以在网站上使用,但性能差,甚至SQLite更好。
SQL Server mdf文件)用于大型网站的大量数据。它更强大,但不能用于手机,必须安装在服务器上。
看看:
After seeing a lot of things in the internet I haven't found any explanation between the two file types: .mdf
and .sdf
.
.sdf
would be a compact version of SQL Server (.mdf
) I believe. Still they appear utterly different.
Have followed the two tutorials on msdn, i.e. MVC Movie App and the Musicstore. Both use .sdf
.
Partial quote (full): 'First of all it should be "|DataDirectory|ASPNETDBContext.mdf" (notice the extension difference). Your applic...'
Both tutorials have the connection string to .sdf
, i.e.:
<add name ="MovieDBContext"
connectionString ="Data Source=|DataDirectory|Movies.sdf"
providerName ="System.Data.SqlServerCe.4.0"
/>
<add name ="MusicStoreEntities"
connectionString ="Data Source=|DataDirectory|MvcMusicStore.sdf"
providerName ="System.Data.SqlServerCe.4.0"
/>
Question:
My question is what to use where and when? More over why to use which where.
SQL Server Compact (sdf files) popular in Windows phone for storing some data (small count of data), also it could be used in web sites, but it has poor performance, even SQLite is better.
SQL Server (mdf files) used in big sites with a lot of data. Its more powerful, but cant be used in phones and must be installed on servers.
Look this: Comparison of SQL Server Compact, SQL Server Express 2012 and LocalDB
这篇关于何时使用.mdf和.sdf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!