带有 NuGet 的 EF 和 SQL Server CE
在浏览 NuGet 时,我注意到我已经安装了几个软件包:EF 和 SQL Server CE。这提出了几个我无法找到任何信息的问题。
在 EF 包上,这会添加 VS 中尚未存在的内容,还是只是为您完成所有参考工作?
在 SQL Server CE 软件包上,这会添加什么而安装它不会添加的内容?或者这只是一种更好的安装方式。
获得环境设置当然需要很多时间,而且我喜欢使用 NuGet 来获取其他软件包,但我不想破坏任何东西,除非从长远来看它最终对我有利。任何评论、答案或轶事都会很棒。
While poking around NuGet I noticed a couple of packages that I have already installed, EF and SQL Server CE. This raised a couple of questions that I have not been able to find any information on.
On EF package what does this add that isn't already there in VS or does it just do all the reference work for you?
On SQL Server CE package, what does this add that installing it doesn't? Or is this just a better way to install it.
It certainly takes a lot to get an environment setup and I like NuGet for other packages, but I do not want to break anything unless it would ultimately benefit me in the long run. Any comments, answers, or anecdotes would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
NuGet 绝对是所有二进制引用甚至 NUnit 等项目工具的前进方向。
我建议引入组合的 EntityFramework.SqlServerCompact 包。这将为每个添加最新的二进制文件,并连接正确的提供程序工厂配置,并在 App_Start 文件夹中添加 WebActivator 以进行连接工厂初始化。 WebActivator 在 ASP.NET 和 Web 窗体中都可以工作,但在非基于 Web 的项目中总是会导致编译错误,但这没什么大不了的。
NuGet is definately the way forward for all binary references and even project tooling such as NUnit etc.
I'd recommend bringing in the combined EntityFramework.SqlServerCompact package. This will add the latest binaries for each and also hook up the correct provider factory config and add a WebActivator in the App_Start folder for Connection Factory initialisation. The WebActivator works in both ASP.NET and Web Forms but will invariably cause a compile error in a none Web based project but this is no big deal.
它添加的另一件事是,这些程序集现在已进行 bin 部署,并且是您的解决方案的一部分。例如,如果您将包文件夹作为项目的一部分提交,并且有人将其检出但没有安装 EF 或 SQLCE,则该项目仍将编译并运行。他们不需要去寻找 MSI 安装程序。
其次,如果您部署到 GAC 中没有这些 DLL 的服务器(大多数没有),那么您仍然可以,因为它们将被设置为“Copy Local to True”。
The other thing it adds is that those assemblies are now bin deployed and part of your solution. For example, if you commit the packages folder as part of your project, and someone checks it out but doesn't have EF or SQLCE installed, the project will still compile and work. They don't need to go hunting for the MSI installers.
Secondly, if you deploy to a server that doesn't have these DLLs in the GAC (most don't), well you'll still be ok because they will be set to "Copy Local to True".