Cannot compile EF4 generated code for MySQL (devart)

Posts   
 
    
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 22-May-2011 10:51:57   

Greetings,

I'm trying to test using LLBLGen to generate EF4 code to use with ASP MVC 3 and MySQL.
Using 3.1 Final (April 14th, 2011).

I added references to the generated code to my Devart assemblies.

When I try to compile the generated code I get:

Error 21 Error 40: The Type DateTime is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.

and a bunch of similar errors that all look related to the MySQL data types.

I'm sure I'm missing something obvious. Can anyone point me in the right direction?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 22-May-2011 11:11:27   

where is the compile error in? which preset did you use? I.o.w: please give as much info as possible, e.g. a repro llblgenproj would be very helpful.

Frans Bouma | Lead developer LLBLGen Pro
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 22-May-2011 20:08:18   

Sorry for the lack of info. It's in the the .edmx file. These lines are what it doesn't like:


    <Property Name="DeaconId" Type="Integer" Nullable="false" StoreGeneratedPattern="Identity" DefaultValue="1" />
                    <Property Name="Email" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Firstname" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Lastname" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone1" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone2" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone3" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="ImageBlob" Type="VarBinary" Nullable="false" />
                    <Property Name="JobTitle" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone1Type" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone2Type" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone3Type" Type="VarChar" Nullable="false" MaxLength="50" />

Ah, preset I was using was EFv1 style--perhaps this is my problem. I will try another preset. I am new to EF. I actually would prefer to use LLBLGen framework, but I'm having trouble getting that to work with MVC scaffolding (which I'd like to use on this project).

Here's the project.

scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 22-May-2011 20:10:17   

And the LLBLGen file.

Attachments
Filename File size Added on Approval
DeaconScheduler.llblgenproj 22,514 22-May-2011 20:10.27 Approved
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-May-2011 03:14:00   

Isn't it needed to do reference Devart.Data.Mysql.Entity to compile that? (http://www.devart.com/dotconnect/mysql/docs/EF.html).

David Elizondo | LLBLGen Support Team
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 23-May-2011 08:46:32   

Yea, I've got that reference, but still get the error. I get the same error when trying to compile the persistence project using the "Proxy Friendly POCO entities" preset. disappointed

I also tried adding this to my app.config:


  <system.data>
    <DbProviderFactories>
      <remove invariant="Devart.Data.MySql" />
      <add name="dotConnect for MySQL" invariant="Devart.Data.MySql"
       description="Devart dotConnect for MySQL"
       type="Devart.Data.MySql.MySqlProviderFactory, Devart.Data.MySql,
       Version=6.30.160.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
    </DbProviderFactories>
  </system.data>

I'm still getting the same types of errors. I'm using the latest version of Devart's dotConnect for MySQL, 6.30.160.0

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 23-May-2011 11:10:31   

We suspected a wrong dbproviderfactory specification in the connection string, but that's not the case. We'll look into what might cause this.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 23-May-2011 15:12:32   

The error you described refers to DateTime, yet the snippet you posted has no DateTime column. We'll look into your project you attached and see whether we can reproduce any issues with that.

btw, you do use the 'professional' version of dotConnect for MySQL? the express one doesn't support EF according to: http://www.devart.com/dotconnect/mysql/editions.html

Not sure what they mean by that as it might mean you get their own EF tools with the professional, but we don't need those of course.

(edit) indeed, only the professional version supports EF. If you use the express or standard version, EF isn't supported.

Frans Bouma | Lead developer LLBLGen Pro
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 23-May-2011 22:55:33   

I'm using the 30-day trial of the professional version. I do have older versions installed on my computer, but they are not referenced by the project.

Sorry, I was truncating the code snippet. I do get errors about the integers too. Here's a more complete code snippet (this is using the POCO preset instead of the EF1 preset I was using before):


                <EntityType Name="Deacon">
                    <Key>
                        <PropertyRef Name="DeaconId"/>
                    </Key>
                    <Property Name="DeaconId" Type="Integer" Nullable="false" StoreGeneratedPattern="Identity" DefaultValue="1" />
                    <Property Name="Email" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Firstname" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Lastname" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone1" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone2" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone3" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="ImageBlob" Type="VarBinary" Nullable="false" />
                    <Property Name="JobTitle" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone1Type" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone2Type" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="Phone3Type" Type="VarChar" Nullable="false" MaxLength="50" />
                </EntityType>
                <EntityType Name="Diagram">
                    <Key>
                        <PropertyRef Name="DigramId"/>
                    </Key>
                    <Property Name="DigramId" Type="Integer" Nullable="false" StoreGeneratedPattern="Identity" DefaultValue="1" />
                    <Property Name="ImageBlob" Type="VarBinary" Nullable="false" />
                </EntityType>
                <EntityType Name="DiagramPosition">
                    <Key>
                        <PropertyRef Name="DigramId"/>
                        <PropertyRef Name="PositionId"/>
                    </Key>
                    <Property Name="DigramId" Type="Integer" Nullable="false" />
                    <Property Name="PositionId" Type="Integer" Nullable="false" />
                </EntityType>
                <EntityType Name="Event">
                    <Key>
                        <PropertyRef Name="EventId"/>
                    </Key>
                    <Property Name="EventId" Type="Integer" Nullable="false" StoreGeneratedPattern="Identity" DefaultValue="1" />
                    <Property Name="EventDate" Type="DateTime" Nullable="false" />
                </EntityType>
                <EntityType Name="Position">
                    <Key>
                        <PropertyRef Name="PositionId"/>
                    </Key>
                    <Property Name="PositionId" Type="Integer" Nullable="false" StoreGeneratedPattern="Identity" DefaultValue="1" />
                    <Property Name="PositionName" Type="VarChar" Nullable="false" MaxLength="50" />
                </EntityType>
                <EntityType Name="Schedule">
                    <Key>
                        <PropertyRef Name="ScheduleId"/>
                    </Key>
                    <Property Name="Comment" Type="VarChar" Nullable="false" MaxLength="50" />
                    <Property Name="DeaconId" Type="Integer" Nullable="false" />
                    <Property Name="EventId" Type="Integer" Nullable="false" />
                    <Property Name="PositionId" Type="Integer" Nullable="false" />
                    <Property Name="ScheduleId" Type="Integer" Nullable="false" StoreGeneratedPattern="Identity" DefaultValue="1" />
                    <Property Name="CheckedIn" Type="Integer" Nullable="false" />
                </EntityType>

and a more complete set of errors:


Error   21  Error 40: The Type DateTime is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.  C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 75  6   DeaconScheduler.LLBL.EF4.Persistence
Error   1   Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 42  6   DeaconScheduler.LLBL.EF4.Persistence
Error   14  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 59  6   DeaconScheduler.LLBL.EF4.Persistence
Error   17  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 67  6   DeaconScheduler.LLBL.EF4.Persistence
Error   18  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 68  6   DeaconScheduler.LLBL.EF4.Persistence
Error   19  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 74  6   DeaconScheduler.LLBL.EF4.Persistence
Error   22  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 81  6   DeaconScheduler.LLBL.EF4.Persistence
Error   26  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 89  6   DeaconScheduler.LLBL.EF4.Persistence
Error   27  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 90  6   DeaconScheduler.LLBL.EF4.Persistence
Error   28  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 91  6   DeaconScheduler.LLBL.EF4.Persistence
Error   29  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 92  6   DeaconScheduler.LLBL.EF4.Persistence
Error   31  Error 40: The Type Integer is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 93  6   DeaconScheduler.LLBL.EF4.Persistence
Error   9   Error 40: The Type VarBinary is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification. C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 49  6   DeaconScheduler.LLBL.EF4.Persistence
Error   16  Error 40: The Type VarBinary is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification. C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 60  6   DeaconScheduler.LLBL.EF4.Persistence
Error   3   Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 43  6   DeaconScheduler.LLBL.EF4.Persistence
Error   4   Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 44  6   DeaconScheduler.LLBL.EF4.Persistence
Error   5   Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 45  6   DeaconScheduler.LLBL.EF4.Persistence
Error   6   Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 46  6   DeaconScheduler.LLBL.EF4.Persistence
Error   7   Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 47  6   DeaconScheduler.LLBL.EF4.Persistence
Error   8   Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 48  6   DeaconScheduler.LLBL.EF4.Persistence
Error   10  Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 50  6   DeaconScheduler.LLBL.EF4.Persistence
Error   11  Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 51  6   DeaconScheduler.LLBL.EF4.Persistence
Error   12  Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 52  6   DeaconScheduler.LLBL.EF4.Persistence
Error   13  Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 53  6   DeaconScheduler.LLBL.EF4.Persistence
Error   24  Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 82  6   DeaconScheduler.LLBL.EF4.Persistence
Error   25  Error 40: The Type VarChar is not qualified with a namespace or alias. Only PrimitiveTypes can be used without qualification.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 88  6   DeaconScheduler.LLBL.EF4.Persistence
Error   2   Error 53: Default values are allowed only for non-XML scalar types and enumeration types.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 42  6   DeaconScheduler.LLBL.EF4.Persistence
Error   15  Error 53: Default values are allowed only for non-XML scalar types and enumeration types.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 59  6   DeaconScheduler.LLBL.EF4.Persistence
Error   20  Error 53: Default values are allowed only for non-XML scalar types and enumeration types.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 74  6   DeaconScheduler.LLBL.EF4.Persistence
Error   23  Error 53: Default values are allowed only for non-XML scalar types and enumeration types.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 81  6   DeaconScheduler.LLBL.EF4.Persistence
Error   30  Error 53: Default values are allowed only for non-XML scalar types and enumeration types.   C:\Users\Rudy\Code\DeaconScheduler\EF4\Persistence\DeaconScheduler.edmx 92  6   DeaconScheduler.LLBL.EF4.Persistence

I have a feeling I'm overlooking something obvious. But I can't seem to find it.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 24-May-2011 12:00:48   
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 24-May-2011 12:03:24   

Walaa, that's about EF v4.1 and code first. Not sure whether that's related. But it could indeed be the case. I'll also see whether this is a bug in our templates or not, though I can't really see why the xml is wrong, the types specified ARE the types needed for MySQL... disappointed

(edit) I get the same errors on EF 4.0, very weird. I'll see what their own 'designer' produces for our test MySQL DB, and will compare the edmx files.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 24-May-2011 12:28:19   

Hmmm.... Their stuff generates this:


  <EntityType Name="typetesttable">
    <Key>
      <PropertyRef Name="FByte" />
    </Key>
    <Property Name="FDecimal" Type="decimal" Precision="10" Scale="0" />
    <Property Name="FByte" Type="tinyint" Nullable="false" DefaultValue="0" />
    <Property Name="FShort" Type="int" />
    <Property Name="FInt" Type="bigint" />
    <Property Name="FLong" Type="decimal" Precision="20" />
    <Property Name="FFloat" Type="float" />
    <Property Name="FDouble" Type="double" />
    <Property Name="FNumeric" Type="decimal" Precision="10" Scale="0" />
    <Property Name="FTimestamp" Type="datetime" devart:DefaultValue="CURRENT_TIMESTAMP" />
    <Property Name="FDatetime" Type="datetime" />
    <Property Name="FDate" Type="date" />
    <Property Name="FTinyBlob" Type="tinyblob" />
    <Property Name="FMediumBlob" Type="mediumblob" />
    <Property Name="FLongBlob" Type="longblob" />
    <Property Name="FMediumInt" Type="int" />
    <Property Name="FBlob" Type="blob" />
    <Property Name="FVarchar" Type="varchar" MaxLength="40" />
    <Property Name="FTime" Type="time" />
    <Property Name="FYear" Type="smallint" />
    <Property Name="FChar" Type="varchar" MaxLength="10" />
    <Property Name="FBinary" Type="varbinary" MaxLength="10" />
    <Property Name="FVarBinary" Type="varbinary" MaxLength="10" />
    <Property Name="FText" Type="text" />
    <Property Name="FTinyText" Type="tinytext" />
    <Property Name="FMediumText" Type="mediumtext" />
    <Property Name="FLongText" Type="longtext" />
  </EntityType>

so lower case names. I'll see if I lowercase the names it will work.

(edit) indeed, lower case works. Except 'integer', that still fails. Why is beyond me. I'll see if I can determine the source of the type names, to see what is supported. Devart... always a pleasure supporting their stuff... disappointed

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 24-May-2011 12:56:50   

Ok, 2 things: 1) we fixed the edmx include template for this. We'll add that shortly to this post (within a few hours) 2) we ran into a small bug in our own driver: VarBinary has as provider type 'VarChar', which should be 'VarBinary'. Due to this bug, to fix your project you also need an updated driver. We'll add that shortly (within a few hours).

Sorry for this inconvenience.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 24-May-2011 14:12:14   

Attached you'll find 2 files: 1) a new MySQL driver dll. Install this file as administrator in the folder: <llblgen pro installation folder>\Drivers\MySQL 2) a new EDMX include template. Install this file as administrator in the folder: <llblgen pro installation folder>\Frameworks\Entity Framework\Templates\Shared\Shared

Then start the designer, load your project and regenerate code. This should fix the problems with the types.

The driver is a debug build, but shouldn't be a problem for now. We'll release a final build on friday. If you run into other problems, please let us know.

Our suspicion about the types is that they generate their own types in the SSDL portion of the EDMX because it ties the EDMX to their MySQLDirect provider, so the SSDL part of the EDMX isn't usable with the MySQL provider from MySQL themselves.

As you need to pay 200$ for the professional provider from devart to use EF, it might be an idea to use our own framework with MySQL instead of EF, because you can then use the 'express' version of MySQLDirect, which is free simple_smile

Attachments
Filename File size Added on Approval
edmxFileInclude.lpt 36,184 24-May-2011 14:13.07 Approved
Frans Bouma | Lead developer LLBLGen Pro
scotru
User
Posts: 104
Joined: 16-Feb-2006
# Posted on: 25-May-2011 08:00:46   

That fixed it! Thanks so much for the quick turn around.

I agree--I'd much rather use the LLBLGen ORM than EF4. I've used it a lot with Winforms apps and I love it--but I'm having trouble getting it working with MVC 3 scaffolding--and I'd really like to save time by not writing basic CRUD code. (see http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=19731). If I can get it working with the scaffolding in ASP MVC 3, or find another way to generate MVC 3 CRUD for LLBLGen, then that's definitely the route I'll take.

Thanks!