Error when trying to reverse map MySql database

4 posts, 0 answers
  1. Henning
    Henning avatar
    6 posts
    Member since:
    Sep 2011

    Posted 29 Sep 2011 Link to this post

    Hello,

    I have a project that I'm trying to use OpenAccess for. It requires reverse mapping a MySql Database to Objects. However the the reverse mapping Wizard fails with the following error on some tables:

    The following problem(s) have occurred :

    1. Unexpected object identity field type: UInt32
    Was expecting one of: System.Int32, System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.SByte, System.Nullable`1[[System.SByte, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Byte, System.Nullable`1[[System.Byte, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Int16, System.Nullable`1[[System.Int16, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Int64, System.Nullable`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Double, System.Nullable`1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Single, System.Nullable`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Char, System.String, System.Object, System.Boolean, System.Guid, System.Nullable`1[[System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.DateTime, System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], System.Decimal, System.Nullable`1[[System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].

    The problem is with the primary key of the table I'd like to map, which ist indeed of type Unit32. Why does this error occur?

    Thanks for any help you can give me.
  2. Ady
    Admin
    Ady avatar
    588 posts

    Posted 04 Oct 2011 Link to this post

    Hello Henning,

     This was a restriction that existed some time ago where uint field as an identity field was not supported. This is now supported. Is there any particular reason why you use the  'Reverse Mapping' wizard from the 'classic' product? You could use the domain model approach to create a .rlinq file. In case you want to continue using the 'Reverse mapping' wizard here are a few steps to work around the problem
    1. Select the primary key field in the wizard (Advanced view) and uncheck the 'primary key' checkbox. Generate the class. This will create an internal ID class that is used to maintain the identity and also a #error is generated with the message - No primary key fields specified, in the class file
    2. Open the <classname>.Telerik.OpenAccess.cs/vb generated file and delete the #error and modify the PersistentAttribute by replacing the 'Identity' property with 'IdentityField'. For example the attribute should similar to - [Telerik.OpenAccess.Persistent(IdentityField="pkField")]
    3. Delete the generate nested ID class which is in the same file.

     Once again I would encourage you to use the Domain model approach to create your model since we would be adding all new features to this approach and the 'classic' approach is in the maintenance mode.
    Greetings,
    Ady
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's SQL Server Community Awards. We are competing in TWO categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. Henning
    Henning avatar
    6 posts
    Member since:
    Sep 2011

    Posted 07 Oct 2011 Link to this post

    Hallo,

    I used the old reverse mapping because it was documented in a pdf file I found on your homepage while the new domain model wasn't. I now switched to the domain model aproach and that seems to fix this problem.
  5. Ivailo
    Admin
    Ivailo avatar
    318 posts

    Posted 07 Oct 2011 Link to this post

    Hello Henning,

    The PDF document you have referred to is deprecated - we are going to make sure this is better clarified in our web site. We apologize if you were misled by it.

    To get started with the Domain Model approach, I can recommend you to check out our videos for the Database First approach (reverse mapping), along with the already recommended online documentation.

    Do not hesitate to get back to us if you need any assistance.

    Kind regards,
    Ivailo
    the Telerik team

    Check out the latest stable build of Telerik OpenAccess ORM. Download it and benefit from our new Project Templates.

Back to Top