How to create a built-in Database for WPF application
I am planning on building a C# WPF desktop application with a PostgreSQL database (to store using settings and some textbox data).
The user of this application will NOT have a database server on their computer. Can I build a "built-in"/"run-time" database (whichever it's called) with WPF application?
I'm new to database application, and my questio开发者_Python百科n is:
Can I deploy a WPF application with PostgreSQL, and user can install and still use the application without a SQL server?
Is deploying an application where user has a SQL server would have any difference to deploying an application where user does not have a SQL server?
I need something of high performance. I have up to 50 concurrent insertion each inserting data in speed of 10 milliseconds, and I'm storing thousands of data in seconds to the database. I don't think SQLite or SQL compact would do that job. I needed the database to be embedded though
Take a look at SQL Server Compact Edition.
Support for ClickOnce, XCopy, MSI, CAB, and non-admin embedded installation options
Edit* What about Sql Server Express, Check this out Embedding SQL Server Express into Custom Applications
It looks like you don't really need SQL per se, so take a look at LevelDB and see if a Key-Value store can fit your needs.
LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values.
It is written in C++ and very fast:
Write Performance
fillseq : 1.765 micros/op; 62.7 MB/s
fillsync : 268.409 micros/op; 0.4 MB/s (10000 ops)
fillrandom : 2.460 micros/op; 45.0 MB/s
overwrite : 2.380 micros/op; 46.5 MB/s
If the user tries to install the application and has no access to the database holding settings and textbox data the application will not work. You will need to have your installer deploy the database as well. I would look into something like sqlite for installation alongside your application.
For that purpose I can suggest you to use Firebird which doesn't have any difference in working with local or remote db
Plesase consider using VelocityDB which is by mine test the best compromise between price and performance for the embedded db solution. It is a NoSQL approach. It supports Linq queries. ORM is not needed just need to implement a generic repository to emulate EF kind of behaviour. 600000k records inserted in 8s 150ms to filter 3k from that subset. Fast.
RavenDB is slightly faster but its footprint in terms of Mb per database is more than 3x bigger than VelocityDB ones. Also RavenDB TCO are elevated.
精彩评论