Does MySQL assignment with Entity Framework 4.0? The acknowledgment is: yes, it works! I aloof put up one beginning activity to comedy with MySQL and Entity Framework 4.0 and in this announcement I will appearance you how to get MySQL abstracts to EF. Additionally I will accord some suggestions how to arrange your applications to hosting and billow environments.
As you may assumption you charge MySQL active somewhere. I accept MySQL installed to my development apparatus so I can additionally advance being back I’m offline. The added affair you charge is MySQL Adapter for .NET Framework. Currently there is accessible development adaptation of MySQL Connector/NET 6.3.5 that supports Visual Studio 2010.
Before you alpha download MySQL and Connector/NET:
If you are not big fan of phpMyAdmin again you can try out chargeless desktop applicant for MySQL – HeidiSQL. I am appliance it and I am absolutely blessed with this program.
NB! If you aloof put up MySQL again actualize additionally database with brace of table there. To use all appearance of Entity Framework 4.0 I advance you to use InnoDB or added agent that has abutment for adopted keys.
Now actualize simple animate activity appliance Visual Studio 2010 and go through the afterward steps.
For archetypal admit the name that is advisory and that you are able after recognize.
Now you can accept how you appetite to actualize your model. Baddest “Generate from database” and bang OK.
Change abstracts affiliation and baddest MySQL Database as abstracts source. You may additionally charge to set provider – there is alone one choice. Baddest it if abstracts provider admixture shows abandoned value.
Click OK and admit affiliation advice you are asked about. Don’t balloon to bang analysis affiliation on to see if your affiliation abstracts is okay.
If aggregate works again bang OK.
Now you should see the afterward dialog. Admit your abstracts archetypal name for appliance agreement book and bang OK.
Click aing on.
Now you can baddest tables and angle your classes are based on. I accept baby database with contest data. Uncheck the checkbox “Include adopted key columns in the model” – it is abuse annoying to get them abroad from archetypal later. Additionally admit advisory and accessible to bethink name for your model.
Click accomplishment on.
Now it’s time to ascertain your classes. Here you can see what Entity Framework generated for you. Relations were detected automatically – that’s why we bare adopted keys. The names of classes and their associates are not nice yet.
After some modifications my chic archetypal looks like on the afterward diagram. Note that I removed attendees aeronautics acreage from being class.
Now my classes attending nice and they chase conventions I am appliance back allotment classes and their members.
NB! Don’t balloon to see backdrop of classes (properties windows) and adapt their set names if set names accommodate numbers (I afflicted set name for Entity from Entity1 to Entities).
Now let’s address simple testing affairs to see if MySQL abstracts runs through Entity Framework 4.0 as expected. My affairs looks for contest area I attended.
And back I run it I get the aftereffect apparent on screenshot on right. I arrested out from database and these after-effects are correct.
At aboriginal run adapter seems to assignment apathetic but this is alone the aftereffect of aboriginal run. As adapter is loaded to anamnesis by Entity Framework it works fast from this point on.
Now let’s see what we accept to do to get our affairs assignment in hosting and billow environments area MySQL adapter is not installed.
If your hosting or billow ambiance has no MySQL adapter installed you accept to accommodate MySQL adapter assemblies with your project. Add the afterward assemblies to your project’s bin binder and accommodate them to your activity (otherwise they are not packaged by WebDeploy and Azure tools):
You can additionally add references to these assemblies and mark references as bounded so these assemblies are affected to bifold binder of your application. If you accept references to these assemblies again you don’t accept to accommodate them to your activity from bin folder.
Also add the afterward block to your appliance agreement file.
It was not adamantine to get MySQL adapter installed and MySQL affiliated to Entity Framework 4.0. To use abounding ability of Entity Framework we acclimated InnoDB agent because it supports adopted keys. It was additionally accessible to concern our model. To get our activity online we bare some accessible modifications to our activity and agreement files.
Seven Things Nobody Told You About Mysql Database Diagram Tool | Mysql Database Diagram Tool – mysql database diagram tool
| Allowed in order to my blog, in this particular time I’m going to provide you with concerning mysql database diagram tool