Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Client Server Installation Package .NET

I guess this is a basic problem which every beginner to Client-Server is looking for: I have developed a C#.NET Client-Server Software.

A basic overview of the application

Application contains a built-in Database, so that if server is not available user can use the database that is available their with their local System. And if the Database is available at Server then the Server database will be used. Both the database synchronize with each other on a click of button. So I have two connection strings, one is for Local System and another one is for Server. They both are getting dynamically created.

For : Client Setup -> Right now I am using Click One Application

  1. My client system uses a Local Database which I use to install along with my application.

PROBLEM 1:

I have a SQL Server Express based database deployment. I created a clickone application with prerequisites like SQL Server 2008. When I install my clickone my application gets installed properly without any errors, but while starting the application, it gives me error that my application is unable to find database at C:\Users\Xnor\AppData\Local\Apps\2.0\Data\N24R9574.9H1\V0Q1MX0C.0X9\....

I surfed stackoverflow and found that copying my .mdf to this location will fix my problem. But why is this happening. Why not it copies itself?

Isn't there any way to attach the DB permanently to my application, so that i can avoid this manual work?

Everywhere its just instructions to copy .mdf file to that location and that's it. So is there any way that could work, maybe if it is possible and suggestible that .mdf would be attached in resources and could be used from there. Looking for expert advice, the best way to accomplish it.


For Server:

I use to install Microsoft SQL Server Management Studio Express and then I use to create Database there for my Server and then IT use to work along with my application.

PROBLEM 2

How can I take these steps down. As telling non-IT people and teaching them to install Microsoft SQL Server Management Studio Express all the time on server and then creating a Database on that and after that giving its connection string to the application to make it work brings lot many issues.


So my basic requirement is just to give a smooth experience to user while installation. As the guys doing installations are not a tall geeks. They can do Next Next Next but they don't like to do so many configurations. Is there any professional way of doing this. As I guess this is the most important thing with Client-Server softwares and I have never seen such softwares to ask you to do so many configurations.

I am not willing to use Click-one Deployment as it looks very unprofessional and I feel its very limited with features. So kindly suggest some other alternate which can serve to this requirement.

Also I am wondering that this is a very important thing, and there is no ready-made tutorial I was able to find on google and youtube, and I am helpless on finding a right direction on How to automatize this thing, or may be a way so that I can reduce the steps.

I am ready to deploy two setups: One for client and one for server

Kindly let me know if any other information is required. Looking forward for a great support. Regards.

like image 868
Django Anonymous Avatar asked Aug 21 '13 07:08

Django Anonymous


1 Answers

Problem 1: Adding SQL database to application - One should do it using the visual studio solution.
Click on the project that uses the database (or better, create a folder first for that), Ctrl+Shift+A>Data>Local Database / Service-Based Database.
then you should populate the database, change the connection strings, etc.
The project will provide you a connection string that can be tempered and be changed in the installation, as the file path can vary.
This way, it'll copy the database among the project installation using your clickonce.

Note: Choosing a database type (SDF vs. MDF) is not such a hard question.
If you can use MDF as it has better performence, better capabilities, but requires local installation of SQLExpress.

Problem 2: SSMS (Menegment Studio) is not required or something like that.
Now, I tend to believe that you are installing the database on the server that run the application - you SHOULDN'T do that. use a dedicated server for the database.
However, for your answer, you can do two things to make it better:
1. You can create a SQL Database named model - which is ideal for database creational as it copies itself to newly databases, and make things easier.
Then, your application can run (in the installation part) SQLConnection.CreateDatabase, which will copy the model and create database for your needs.
2. Yoy can migrate to a newer solution like using EntityFramework, which there you develop your classes and the EF is responsable for the storage.

I havn't used Clickonce for a while, but I know you can make a customized version of it with your texts, your logo... If you want to automate, one of the steps is running your code, if you provide it. you can create installation files. Simply create (Ctrl-Shift-A) Installation file (its there), where you can override methods and run what you want (File copying, adjustments, requirement checks..)

like image 82
Amir Ofir Avatar answered Sep 22 '22 18:09

Amir Ofir