SQLite Boolean and Date Field

Questions concerning use of SchemaCoder

SQLite Boolean and Date Field

Postby thomas_wong on Wed Jul 22, 2009 10:53 pm

I am running into problems with code generated against SQLite database. For some reason, the default behavior doesn't recognize Date fields and Boolean fields. I have figured it out how to modify the attribute mapping so that all the retrieval methods can convert the type correctly, using the very nice gui on the "Attributes" tab.

However, I can't seem to remap the data type for the Insert and Update method. Doesn't matter what I do, the method still try to put a string in both Date fields and Boolean fields.

Is there a way to re-map the data type for Update and Insert method?

Thanks,

Tom
thomas_wong
 
Posts: 4
Joined: Tue Jul 21, 2009 4:12 pm

Re: SQLite Boolean and Date Field

Postby Michael A. McCloskey on Thu Jul 23, 2009 9:23 am

SQLite is a bit of a different animal when it comes to data types in that it uses dynamic typing, rather than static typing like all the other supported databases.

Please refer to http://www.sqlite.org/datatype3.html

Since one can call their data type pretty much anything they want, SchemaCoder relies on an internal mapping of datatypes to .NET data types. The supported mapping is as follows:

Code: Select all
bigint           - Int64
binary           - Byte[]
blob             - Byte[]
bit              - Boolean
char             - String
datetime         - DateTime
decimal          - Decimal
float            - Double
image            - Byte[]
int              - Int64
integer          - Int64
money            - Decimal
nchar            - String
ntext            - String
numeric          - Decimal
nvarchar         - String
real             - Single
smalldatetime    - DateTime
smallint         - Int16
smallmoney       - Decimal
text             - String
timestamp        - DateTime
tinyint          - Byte
uniqueidentifier - Guid
varbinary        - Byte[]
varchar          - String
xml              - String
All Others       - String


As you can see, anything unknown is mapped to string. For entity inference to work with your example, your Boolean column should be declared as having a "bit" data type and your Date column should be declared as a "datetime" data type. This is the scenario that is currently tested and supported.
Michael A. McCloskey
Site Admin
 
Posts: 29
Joined: Tue Jul 15, 2008 7:11 pm


Return to Questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron