Tag Archives: linux

Mono: Entity Framework – System.Data.Entity.Core.ProviderIncompatibleException was thrown

Recently I have been playing with Entity Framework on Linux using Mono and my database server is MS SQL 2014. When I attempt to add an entity I receive the “System.Data.Entity.Core.ProviderIncompatibleException was thrown” exception and the following message was displayed:

An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application’s config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.

So I did some further investigation online and found the following post on how to work around it:

https://entityframework.codeplex.com/discussions/538142

Continue reading

Mono: Entity Framework – Basic Setup Guide

So you have been using Entity Framework on Visual Studio and now you would like to code in Linux using Mono and still be able to use Entity Framework. Well this post will give you some basic steps to setup your SQL server and Mono project to get a simple database going.

Setting SQL Express

Before we can go any further we need to have Microsoft SQL Server Express installed ¬†on a Windows server. For my own setup I already have a virtual machine with Windows Server 2012 running and SQL Server Express 2014 installed. It’s up to you to choose own setup, and it doesn’t have to be the same as mine.

Create Your SimpleDatabase

Now we need to create our test database on SQL Server by running the following SQL statement on your script editor of choice:

CREATE DATABASE SimpleDatabase

 

Screenshot from 2014-06-17 21:19:27

Now you should have a brand spanking new database created and ready to be populated with data. Continue reading

Ubuntu Command Line Upgrade to New Release

Just recently there was a new release for Ubuntu and I have a few Ubuntu installed on virtual machines. I normally telnet to the machines to perform updates, and upgrades. To upgrade via the command line open your terminal and enter the following command:

$sudo do-release-upgrade -d

The switch -d checks if upgrading to the latest release version is possible.

Writing a Simple Linux Daemon Program

I have decided to write a watcher daemon to watch a specified folder for any newly created files or folders. I did some googling and found that it was very simple to create a daemon program in Linux.

First you will need to create your source file and include the following header file:

#include <unistd.h>

In the main function you need to call daemon() like this:

int main()
{
    if (daemon(0,0) == -1)
         err(1, NULL);
    while(1)
    {
         Do something here....
    }
}

In the while loop you can put your own code to perform a specific task. 

To run the daemon when your system boots up edit the file /etc/init.d/rc.local and add the following line at the end of the file:

/usr/sbin/yourdaemon

note: make sure the you copied the file to /usr/sbin or else the file can not be found when the system is booting up.

The daemon function parameters, I have specifice 0 for the first paramter to use the root “/” folder instead of the working folder and the second parameter I have done the same which will redirect all standard input, output and errors to /dev/null.

Detailed information on how to use the daemon function can be found here.