Can .mdf use as embedded database?
I am new to C# and SQL Server databases, so this may be a stupid question but I am confused.
I want to setup an embedded database on a client machine automatically when he installs my application. I know SQL Server Compact Edition is there but there are so many restrictions in SQL Server CE.
Can I use .mdf files as an embedded database? If yes then how can I setup it on client machine automatically? or is there any other option to solve my problem?
I would recommended to use SQLite. It is simpler to deploy. Also, SQL Server Compact appears to be discontinued.
You can use SQLite which doesn't require any installation on the client machine.
SQLite depends on the Visual C++ runtime, but you don't need to install it on the client machine. The system.data.sqlite download page contains several "static" packages that already contain the runtime.
All the "static" packages contain either native or mixed-mode assembly binaries linked statically to the appropriate version of the Visual C++ runtime. Typically, these packages are used in cases where customer machines may not have the necessary version of the Visual C++ runtime installed and it cannot be installed due to limited privileges.
For example, on my machine I am running Windows 8.1 x64 so I went under Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0) and downloaded sqlite-netFx40-static-binary-x64-2010-126.96.36.199.zip.
This binary package contains all the binaries for the x64 version of the System.Data.SQLite 188.8.131.52 (3.8.2) package. The Visual C++ 2010 SP1 runtime for x64 is statically linked. The .NET Framework 4.0 is required.
I then unzipped the package and ran test.exe to make sure everything works. Zero installation required.