Mapping Issue with tinyint , need help ...

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
anthony888999
Posts: 2
Joined: Sun 28 May 2017 21:52

Mapping Issue with tinyint , need help ...

Post by anthony888999 » Mon 26 Jun 2017 05:34

with mysql - tinyint(1) LinqConnect is mapped to property type System.Boolean, and that's the correct behavior I can work with my compiler.
When I use the same data structure tinyint(1) from sqlite3, the mapping property will mapped to System.byte
As a result, I had a compiler error with type mismatch.
I sure don't want to do type cast all over the place, it's just too much code modification and generated too much confusion.

(I checked some support Reference)
Entity Developer:
viewtopic.php?f=31&t=23255&p=77915&hilit=tinyint#p77915

The behaviour is changed: the TINYINT(1) data type is now used for the columns which correspond to the System.Boolean properties (MySQL)

One workaround is to go through all my datatype with "Class Editor" and manually modify all the relevant byte to bool. But, that's time consuming when I have many to modify.

Also, longblob are mapped to System.byte[] from mysql ( which is what I wanted )
but, in sqlite3, longblob are mapped as a System.object
Now, I have to go through all my tables one by one with "Class Editor" many times
Please Help ...
Last edited by anthony888999 on Mon 26 Jun 2017 06:22, edited 1 time in total.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Mapping Issue with tinyint , need help ...

Post by Shalex » Fri 30 Jun 2017 16:34

anthony888999 wrote:When I use the same data structure tinyint(1) from sqlite3, the mapping property will mapped to System.byte
A default Database First mapping for the newly created models can be customized via:
* Visual Studio > Tools > Entity Developer > Options > Server Options > SQLite (for Entity Developer embedded in VS)
* Entity Developer > Tools > Options > Server Options > SQLite (for a standalone Entity Developer)
anthony888999 wrote:Also, longblob are mapped to System.byte[] from mysql ( which is what I wanted )
but, in sqlite3, longblob are mapped as a System.object
There is no longblob in Server Options for SQLite, that's why it is mapped to System.Object. Actually, blob (available in Server Options) and longblob correspond to the same affinity type: https://sqlite.org/datatype3.html. Is it possible for you to use blob (instead of longblob) in your SQLite database?

Post Reply