Creating .NET Core REST API with embedded database - c#

Is it possible to create a .NET Core REST API which will contain an embedded database (possibly .mdf file) and still deploy it on other OS like Linux? I know that SQL Server can be installed on Linux but can this be done silently within the application's installation program?

There are a number of different options. Some that you might want to consider:
SqlLite (relational)
LiteDb (nosql)
DBreeze (key-value)

Related

Can MySQL be installed as an embedded database with an offline application?

I was with the choice of SQLite as database for easy distribution of my offline c# desktop application (WPF / Winforms) but currently cornered to MySQL database due to IRD certification.
My main concern is that I want to know If I could use MySQL database for offline desktop application and distribute .exe via URL for easy unattended installation.
Is it possible?
As shown on SQLite's page Appropriate Uses For SQLite, a client/server database like MySQL would work better for client/server applications, high-volume websites, very large datasets, or high concurrency. Nothing of this applies to your offline application, so you should use a database that was designed to be embedded (not necessarily SQLite).
MySQL has an embedded server library which can be linked directly into an application. When using C#, the MySQL library is linked into the .NET MySQL database driver, so using the embedded server would require recompiling this driver. And such linking will trigger MySQL's GPL license. And:
The libmysqld embedded server library is deprecated as of MySQL 5.7.17 and will be removed in MySQL 8.0.
It would be possible to install the standalone MySQL server yourself; this is described in Installing MySQL on Microsoft Windows Using a noinstall Zip Archive.
However, this would still run the MySQL server as a separate process or service, and this could conflict with other installations on the machine; it would be your installer's responsibility to configure that MySQL instance correctly for whatever environment it encounters on the target machine.

How to add a portable database to an MVC application?

I currently have an ASP.NET MVC 3 project, plus a class library project, that I am planning on open-sourcing. Before I do that though I want to clean up the project a little bit. One modification I want to make is with the database. Currently the site is published to a shared hosting server and I setup the SQL database on that server. However, since people will be forking the project and running it locally I'd like to just attach a SQL server express database or something that is part of the project. I want people to clone the repository, open the project, press F5 and have it run. Currently they'd have to setup a SQL database and create all the tables and stuff.
The solution consists of two projects: MvcUI and Domain. Domain is where all the application logic occurs. In fact, the domain is UI agnostic which means that it could be consumed by a desktop application just as easily as it could be by a web application.
I would like the database to be part of the Domain (class library) project. I have never done this before. If anyone could provide a simple explanation for how I would need to go about setting this up I would be thrilled. It would be very nice to have the database just be a in the solution because I could pre-populate it with some basic data. What do I need to do to get this database in my project as a database file or what not?
SQL Server Compact Edition is a portable SQL database that should do exactly what you are asking.
Microsoft SQL Server Compact 4.0 is a free, embedded database that
software developers can use for building ASP.NET websites and Windows
desktop applications. SQL Server Compact 4.0 has a small footprint and
supports private deployment of its binaries within the application
folder, easy application development in Visual Studio and WebMatrix,
and seamless migration of schema and data to SQL Server.

service based database

I have one problem with service base database, I have used it in one of my application but I dont know if user who'll use it need to have something installed to be able to run application (like you need to have installed NET framework for c# applications)
Note: This is windows application
It depends on what database engine you're using. SQL Server/SQL Express/Oracle/MySQL require you install the application on the machine before it'll work. databases engines like SQLite and Firebird are just Dll's, so you can include then in your project.
If the file is an MDF that's a SQL Server file - you need to install SQL server, or SQL express.
You can include it with your app and do it silently:
http://social.msdn.microsoft.com/forums/en-US/sqlsetupandupgrade/thread/7180e4dc-5c1e-4501-83d7-6882abb1f04e/
You will need to install the relevant database engine with the correct service name, and create the database and relevant objects on installation.

How to make software developed in WinForms .NET 3.5 with SQL Express portable

i found that its really pain to create setup and deployment packages for windows xp/vista/7
so my question is can i make my application portable with any third party tool such as thin app ?
my application requires dot net 3.5 framework and sql express 05 installed i want to put it on usb drive and user can execute it directly from usb drive without any setup and deployment, if there any other ways to achieve portability for software please let me know?
thanks !
In order to check if .Net 3.5 and sql express is installed you can check if they are registred in the registry.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion - CurrentVersion
But you cannot check this with your 3.5 compiled assembly, so you need a non-dotnet application to do it, like a setup program.
Either you have to create a launcher in something like c++, or you could create a vb script launcher which checks the prerequisites before launching your .net app.
Neither SQL Express nor the .NET Framework will not run without being installed on the local hard disk.
Source for SQL Express: http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/fc729d31-8a0b-4156-ab75-4fec652a438b.
#Mikael already told the trick for .NET detection which you should take a look at.
I just want to add that for portable applications, you should use SQL Server Compact edition instead of Express,
Link

MySQL client portability for my C# app

I am building an application which needs to connect to a central MySQL database. The application is written in C#. I have installed the .NET connector from MySQL for the VS integration.
I was wondering if there is anything special I need to do to be able to have my application be portable and not require an install of the connector on every machine it is used on?
There is a similar question I found here on SO, but it is for a server instead instead of client which is very different.
Edit:
Connector I used: .NET connector 6.2.3 (
http://www.mysql.com/downloads/connector/net/)
When you make an installer, you can include the dll for the mysql connecter such that it is copied along with the other side. This way, whenever the application is installed properly, you wont have the problem.

Categories

Resources