开发者

Portibility concern in a c# and ado.net application

开发者 https://www.devze.com 2023-04-12 11:40 出处:网络
greetings to all the members for taking time to read this question. I am preparing an application for a quiz system that will take random questions from the database and put them in the i开发者_JAVA技

greetings to all the members for taking time to read this question.

I am preparing an application for a quiz system that will take random questions from the database and put them in the i开发者_JAVA技巧nterface(c#) using ado.net.

My question is i want the program to be portable , i.e yout dont have to install completely the sql server on all the systems i will run my code (if i user sql server drivers).

What is the solution for this problem ??


You may choose Sql CE (Compact) database.

Blog from Scott Guthrie :

SQL CE does not require you to run a setup or install a database server in order to use it. You can simply copy the SQL CE binaries into the \bin directory of your ASP.NET application, and then your web application can use it as a database engine. No setup or extra security permissions are required for it to run. You do not need to have an administrator account on the machine. Just copy your web application onto any server and it will work. This is true even of medium-trust applications running in a web hosting environment.


Don't use SQL Server.

You can use a database like SQLite that can be used via ADO.NET and distributed with your application instead of requiring a separate database installation.

Note that this approach may or may not be enough for your actual database needs.


I like AVD's answer and is probably the way to go, but using linq to XML would be a good alternative for portability.


Serialize your DataSet as a binary file.

DataSet ds = GetData();
ds.RemotingFormat = SerializationFormat.Binary;
BinaryFormatter bin = new BinaryFormatter();
bin.Serialize(stream, ds);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号