Sqlite autoincrement warning

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Sqlite autoincrement warning

Post by dilbert » Thu 21 Jun 2012 08:31

Entity Developer 4.4.197 now generates warning in .cs file (in VS 2010) for all SQLite primary keys with AUTOINCREMENT flag:

Code: Select all

Field 'DB.Users._Id' is never assigned to, and will always have its default value 0

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Sqlite autoincrement warning

Post by MariiaI » Mon 25 Jun 2012 12:35

This is the expected behaviour: since the entity key property has no setter, the corresponding field cannot be changed without using reflection.
We don't generate the code for a setter of properties that correspond to the autoincrement fields because there is no need in it (key is get from the database and assigned directly to the field, upon which the primary key property is built).

dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Re: Sqlite autoincrement warning

Post by dilbert » Tue 26 Jun 2012 09:29

Thank you for the comment. I agree that there is no need to generate a setter for autoincrement fields (at least in Sqlite).
However, generally, code that generates warnings could be confusing. Especially when there is a simple solution to generate setter with private access modifier or, even simpler, initialize its value in declaration (int _Id = 0).

I realize it isn't really a big issue and all real bugs should have higher priority. I'm just trying to keep my code without warnings...

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Sqlite autoincrement warning

Post by MariiaI » Tue 26 Jun 2012 10:57

Thank you for the suggestions. We will consider the possibility of disabling such warnings and inform you about the results.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Sqlite autoincrement warning

Post by MariiaI » Wed 27 Jun 2012 09:04

The warning, related to the missing setter of properties, that correspond to the autoincrement fields, has been disabled. This update will be available in the next build of dotConnect for SQLite, which we plan to release in two weeks.

Post Reply