Working with MySQL – EF5 – MVC5 Alltogether


For MySQL part;

Never install the MySQL from Web Platform Installer.Get to MySQL’s website and download MySQL Installer.

This installer package installs everything you need about database-end including;

MySQL Connector
MySQL for Visual Studio
MySQL 5.5 Database

For EF5 part;

Install EF5 via Nuget like this;

Install-Package EntityFramework -version 5.0.0

This will install EF5 which works great with MySQL Connector.

For MVC5 Part;

Download MVC5 package from Microsoft download page if you haven’t already.

Add reference to EF5 libraries:
MySQL.Data.Entity (4.5 version) –> This is for EF5

“MySQL.Data.Entity for EF6”  libraries are for Entity Framework 6.But be cautious; this library may not be compatible with the connector you’re using.They need to upgrade MySQL Connector according to EF6 since there are lots of changes.

Web.config settings:

    <defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF5"></defaultConnectionFactory>
    <add name="YourEntities" connectionString="metadata=res://*/Models.YourModel.csdl|res://*/Models.YourModel.ssdl|res://*/Models.YourModel.msl;provider=MySql.Data.MySqlClient;provider connection string= server=localhost;user id=root;password=yourpass;database=yourdb " providerName="System.Data.EntityClient" />

If you’re using EF6,downgrade it to EF5.


NodeJS Series #6: Event-Driven Programming


Hi Wizards,

Its been some time since I’ve left Hogwarts Magicians School for a small holiday.Now that Im back,im ready for some tricks.

But before that,i’d like to talk about Event-Driven Programming and in its place in NodeJS

What is Event-Driven Programming?

Event-driven programming is the term where the flow of the code is determined by events(click,load,etc…)
Its one of the basic milestone today’s popular programming languages such as C#,Java and many more I dont wanna fill up here.
In Node.js and moreover in any kind of Javascript project,you’ll be using or used event-driven process.Whether its page onload or button click event,this is something you have achieved with our without knowing.

Lets make an example to the classic event-driven process and how its done in NodeJS:

result = getJSONfromDestination();

The operation above requires blocking I/O process (single thread operation that waits for previously working synchronous code )

Now lets take a look at how we do asynchronous way to do it(Non-blocking I/O process)

json_finished = function(result){

As you can see,this is non blocking sample,because json_finished doesnt work first as you can imagine.
It starts working when you call getJSONfromDestination method and sending param as function to json_finished.

This is how Asynchronous operations are completed in mainly Javascript projects and widely used in NodeJS projects.In case of working step-by-step,we send params to functions to start working whenever & however we want.

You’ll be using frequently these kind of Asynchronous operations or in other terms “Event-Driven Programming” style in almost all of your JS oriented applications,not to mention coding like that is a “must-have” in NodeJS applications.

Next article,we will be experiencing a real world problem for detailed workaround.

NodeJS Series #5: Installing,Uninstalling,Updating Modules


Hi Wizards,

Do you remember what we did previously? We created a Port Listener which listens to a port and get response.
In that post, we used a module named “http” to send request and get response.

Now im gonna talk about “Modules” and how to use them.


Node Package Manager consists of many modules that can be downloaded and used in your project.The list of repository can be accessed from:

You can however specify if a module will be used local or global.

What does that mean?

Global means it can be used in other projects as well.But by default,Local mode is preferred.

Note: you can install a module globally by adding “-g” parameter.

Important Note:Before installing a module,make sure you create a folder in a near destination.I will be using a test folder in my desktop.

Installing a Module

Installing a module is easy,lets get back to and select a module to install browserify:


Now open your Nodejs Command Prompt and head to the folder you just created.


Now add these lines to install browserify in the specified folder:

npm install browserify

Press Enter and let it download dependencies and browserify module itself.

Once its finished,you can have a look at your folder structure being replaced by browserify module and its dependencies.

UnInstalling a Module

Since we installed Browserify,why dont we use the same module?

To Uninstall a module you simply,write this command:

npm uninstall browserify


And it will uninstall browserify and its dependencies.


You shall see in your project folder that the modules are gone.

Updating a Module

Why do we even update? To get the latest version of course!

If you previously used an older module with new version available,you’ll desire to update it in no time.

To Update a module you simply write this command:

npm update browserify

Rest is up to NPM.It will update the specified module.Since we uninstalled the browserify module previously however you can test it after you install it again:


We talked about a great deal managing modules in this post.Hope it was useful information for you,Wizards 🙂

See you next time.

NodeJS Series #4: Creating a Port Listener


Hello Wizards,

First of all,sorry I couldn’t publish this post as I promised,i had illness.Even Wizards get sick!
The purpose of this post is all about creating a server,listening it through a port number and then sending output to the browser.

So lets start immediately!

We shall write a small script that creates server and listens to this object.

var http = require("http");

http.createServer(function (request, response) {
    response.writeHead(200, { "Content-Type": "text/plain" });
    response.write("Listening to localhost:8888");

Lets take a breath and talk about what this script does in detail,shall we?

var http = require("http");

1st line of the code tells us it will use http object and implement it.You can realize this statement as importing a namespace to a project and referencing it.


http.createServer(function (request, response) {

This code does create server object with 2 parameters: request and response.Clearly you know HTTP works according to Requests and Responses.Same thing here.


    response.writeHead(200, { "Content-Type": "text/plain" });
    response.write("Listening to localhost:8888");

As mentioned earlier,when you request this server object,it will send 200 code(Success) and Content-Type Headers to the server object.Afterwards,we will write specifying as if it listens to the server via a port number and laters we end response object so that we cand send buffered output to the response and stop executing the page and thus ends the request.



Now thats the last thing, we should be doing : Listening to the port number.

You do realize we only used a port number here? That means we shall use “localhost” for testing purposes.

Cant we use an IP with port number? Yes you can!

If you have changed the code just like that:

}).listen(8888, ''););

It would still work.

Now since we cleared a few things up here,we can test the server now!

Store the sample js file in a close location and then run Node.js Command Prompt:


Press Enter.

You realize server object created and now listens to the localhost:8888 right? 🙂

So,open your favorite web browser and navigate to this server!


As long as Nodejs Command Prompt runs,you can access the server object and do some stuff!

Remember one thing: Creating a server object is the 1st step creating a Rest service with Node.js.
And I plan on writing a post about it in the following series.

I hope this post was useful for you.


NodeJS Series #3: Using External Files


Hello Wizards,

This time we will create external .js files to call from NodeJS Command Prompt.

Create a new .js file (for instance I’ve created sample.js).
Add these javascript lines as an example:


When we call external file from nodejs command prompt,it shall write “Pooff” as an output.

Store this file to a close destination,easy to access later from command prompt.Now open “Nodejs Command Prompt” application and call this:


Then press enter and see what happens.According to me,I get this one:


Its that easy to call external files with Nodejs.

Do you want much more complicated and real-life solution? Wait for tomorrow, Wizards 🙂

I shall show you how to listen to a port tomorrow.

NodeJS Series #2: Installing the Device and Casting a Simple Spell


Hello there Magicians,

Ready to enter to the world of Node Spells?

Lets install the Node.js now via


Click on Install and start executable setup file.


Complete the installation.

Then open “Node.js” application with green icon to start casting your spells.


Lets say we want to write “Poooof” on the console,heres how:



Well Done Wizard!
This was your first spell with Node Device and you’ve successfully did it!

Next time you shall see how to install and run seperate Node spells and master at it!

See you till next time.