Converting Entity model created with Connector.Net?

Converting Entity model created with Connector.Net?

Postby babackman » Thu 18 May 2017 21:40

I have a large Entity model that was created with Oracle's Connector.Net for MySQL. I'm trying to convert my solution over to DotConnect. Is there a walkthrough somewhere that might show me how to modify my edmx in place to use DotConnect? I tried changing the Provider and ProviderManifectToken values at the top, but Visual Studio will no longer load it in the diagram editor any more. Given the number of times I've had issues with updating the model from the database in the past with simpler changes, I would really rather avoid starting over, rebuilding the model from scratch, and trying to determine what customizations were made to the previous model and need to be redone on the new one.
Posts: 2
Joined: Thu 18 May 2017 21:31

Re: Converting Entity model created with Connector.Net?

Postby babackman » Fri 19 May 2017 20:11

I got it working. I'll briefly describe the steps I went through in case someone else finds themselves in a similar situation.

For comparison, I created a new blank project and created an Entity model of my database from scratch using dotConnect.
I copied the Provider and ProviderManifestToken from the StorageModel in the new EDMX into my old one. That caused Visual Studio to stop displaying the model.
Looking at the EDMX in the XML editor, there were errors like the following
Code: Select all
Type bool is not qualified with a namespace or alias. Only primitive types can be used without qualification.

Those errors had been there before with Connector/Net and everything still worked, so I was used to ignoring them.
Comparing to the new model, I saw dotConnect had assigned those fields a type of "sbyte" so I changed bool to sbyte throughout my existing model. That allowed the diagram to load, but created new errors:
Code: Select all
Member Mapping specified is not valid. The type 'Edm.Boolean[Nullable=False,DefaultValue=]' of member 'IsDeleted' in type 'MyNamespace.MyType' is not compatible with 'Devart.Data.MySql.sbyte[Nullable=False,DefaultValue=]' of member 'IsDeleted' in type 'MyNamespace.Store.MyType'

By some luck, there was exactly one boolean column in my schema that had been declared the way dotConnect apparently wants it to be declared so I was able to determine a) dotConnect has a boolean (not bool) type and b) the corresponding column has to be declared as bit(1) NOT bool.
Big enhancement opportunity DevArt -- recognize tinyint(1) as a boolean when updating the model from the database. Especially since dbFusion for MySQL will take fields declared as bool, and send them over to the server as bool, but they won't be recognized by dotConnect when the server sends them back as tinyint(1).
Posts: 2
Joined: Thu 18 May 2017 21:31

Re: Converting Entity model created with Connector.Net?

Postby Shalex » Mon 22 May 2017 14:35

1. We recommend you to use Entity Developer (the Devart Entity Model item, *.edml) instead of EDM Designer (the ADO.NET Entity Data Model item, *.edmx) because it is adjusted for working with MySQL and has an advanced functionality:

2. Assuming that dotConnect for MySQL Professional is already installed on your workstation, here is a recommended way of converting *.edmx (MySql.Data.MySqlClient) to *.edml (Devart.Data.MySql):
  • install Entity Developer Professional Trial for migrating (you can uninstall it after the migration is done, it is needed because it supports MySql.Data.MySqlClient your model was originally created for)
  • open your existing *.edmx model in Entity Developer
  • change provider to Devart.Data.MySql via Database Explorer
  • right click on designer surface > Regenerate Storage and Mapping
  • save model (as *.edml). Entity Developer allows only to import *.edmx but the output would be *.edml. Output can not be *.edmx because Entity Developer uses extra tags and attributes, additional features which are not supported by EDM Designer. This question was discussed at
  • uninstall Entity Developer as a separate tool. dotConnect for MySQL Professional includes its own Entity Developer which can be used only with Devart.Data.MySql
3. Here is a default mapping:
If necessary, you can change default mapping:
  • via the Tools > Options > Servers' Options > MySQL menu (applied only for Entity Developer, *.edml)
  • using the Tiny As Boolean connection string parameter to specify whether the provider should treat TINYINY(1) columns as boolean, a default value is false (applied only for EDM Wizard, *.edmx)
Devart Team
Posts: 7949
Joined: Thu 14 Aug 2008 12:44

Return to dotConnect for MySQL