简体   繁体   English

使用SQL Server部署WPF应用程序

[英]Deploying WPF applications with SQL Server

Ok so I'm developing a WPF application that makes heavy use of SQL Server. 好的,我正在开发一个大量使用SQL Server的WPF应用程序。 I've been asked to create an installer package that checks whether the client already has SQL Server Express 2005 already installed, his operating system (64bit Vs x86) and install the required SQL Server instance if needed. 我被要求创建一个安装程序包,用于检查客户端是否已安装SQL Server Express 2005,操作系统(64位Vs x86)并根据需要安装所需的SQL Server实例。

I'm then required to automatically map my App.config's connection string to the SQL Server's connection string and run a script to create my database. 然后,我需要自动将App.config的连接字符串映射到SQL Server的连接字符串,并运行脚本来创建我的数据库。

Is it just me, or does this look like a lot of hard work? 它只是我,还是看起来像是一项艰苦的工作? Any idea where to start? 知道从哪里开始?

Edit: Ok should I move to SQL Server Compact edition? 编辑:好的,我应该转移到SQL Server Compact版本?

Thanks! 谢谢!

Unfortunately this sounds about right; 不幸的是,这听起来很正确 one the guys on my team got lumped with this job and it's been taking up a significant amount of his time to do all of this. 我团队中的一个人对这项工作感到困惑,并且他花了很多时间来完成所有这些工作。 Using install shield to fire off the necessary SQL install packages and then go into all the various app.configs and edit any paths/connections that are unique to the machine. 使用安装屏蔽来启动必要的SQL安装包,然后进入所有各种app.configs并编辑机器特有的任何路径/连接。

Further down the line we've also had to consider the fact that every machine has a potentially unique app.config file so we had to add/delete and edit various keys as part of a software upgrade. 更进一步,我们还必须考虑这样一个事实:每台机器都有一个可能独特的app.config文件,因此我们必须添加/删除和编辑各种密钥作为软件升级的一部分。

As above, we've been using Install shield to handle all of this. 如上所述,我们一直在使用Install shield来处理所有这些问题。 Just don't expect it to be a quick job! 只是不要指望它是一个快速的工作!

No it is not just you, this will be a lot of work! 不,不只是你,这将是很多工作! It is also incredibly difficult and time consuming to get right. 做到这一点也是非常困难和耗时的。

A common approach to this problem ie having large system dependencies, is to have the dependency (in this case SQL server) as a "pre-requisite" to installing your software. 解决此问题的常见方法(即具有较大的系统依赖性)是将依赖关系(在本例中为SQL Server)作为安装软件的“先决条件”。 Your installation package checks to see if the dependency is installed, and if it isn't, advises the user that it needs to be in place before installing your software. 您的安装包会检查是否已安装依赖项,如果未安装,则建议用户在安装软件之前需要将其安装到位。 If the dependency does exist, then your package can go through the steps of installing your schema into it. 如果依赖项确实存在,那么您的包可以完成将架构安装到其中的步骤。

The onus is then on the user, or the systems administrator\\IT, to get the dependency set up. 然后,用户或系统管理员\\ IT负责设置依赖关系。 This may even be required as the user may not have privileges to install something like SQL server. 甚至可能需要这样做,因为用户可能没有权限安装类似SQL Server的东西。 The user may even want to use a shared database ie not on their local machine. 用户甚至可能想要使用共享数据库,即不在本地计算机上。 Not sure what your circumstances are... 不确定你的情况是什么......

Based on your question, it seems that the client and the server is always going to be on the same machine, no remote access. 根据您的问题,似乎客户端和服务器总是在同一台机器上,没有远程访问。

Today with Entity Framework you have almost full support of SQL Server CE, I think you would really want to take a look on it. 今天使用Entity Framework你几乎完全支持 SQL Server CE,我想你真的想看看它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM