In general, getting EF work with MySQL is a fairly simple task, that could be accomplished by downloading and installing ADO.NET driver for MySQL. But what concerns to me, it taken me about four hours to clarify some MySQL-specific details that affect generation of associations in Model Designer. Also after doing an experimentation with the code I realized that ADO.NET driver for MySQL, as well as other third party ADO.NET drivers, do not support “MARS” and, as far as I see, this significant restriction makes EF unusable with MySQL in large real-life projects. Please read below if you interested in more information on this questions.
(more…)
Category Archives: C#
Using ADO.NET Entity Framework with MySQL
Seeing design time data in a WPF control
Sometimes the ability to see the data at design time significantly facilitates the creation of WPF controls. If I am developing a WPF control with complex UI using data bound controls, I usually define a property for accessing some typical data item:
public static ComplexData DesignTimeItem
{
get
{
using (DatabaseContext db = new DatabaseContext())
{
var products = from p in db.products.Include("ProductType")
where p.product_id == 131
select p;
product product = products.First();
return new ComplexData(product, "100 kg");
}
}
}
