This is a migrated thread and some comments may be shown as answers.

Problem mapping SQLite database

4 Answers 158 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
SteveL
Top achievements
Rank 2
SteveL asked on 14 Jul 2010, 06:11 PM
I was very pleased to see SQLite databases now supported, as I've been waiting for this for some time now, so I am trying to change my project to use OpenAccess ORM instead of Entity Framework.

After I have added a Domain Model, I get the error: The specified ado type of the column timestamp does not exist.

'Timestamp' is my primary key, and is of type DateTime. So I set the type to DateTime using the Resolve Validation Errors dialogue, and build my project.

I then get the error:

Error   56   Field: 'System.Object CumulusService.StandardDatum::timestamp': The type of the single field identity field must be System.Byte, System.Int16, System.Int32, System.Int64, System.Guid, System.Char or System.String.
Parameter name: fieldType   C:\Users\steve\Documents\Visual Studio 2010\Projects\CumulusService\CumulusService\obj\x86\Debug\CumulusService.exe   CumulusService

What does this mean, please? Please don't say that OpenAccess ORM doesn't support a DateTime primary key? I don't have this problem with EF.

Steve

4 Answers, 1 is accepted

Sort by
0
Accepted
Alexander
Telerik team
answered on 15 Jul 2010, 02:36 PM
Hello SteveL,

I am afraid that this is not supported right out of the box but there is a workaround that would work fine. Let me explain a bit - each persistent class has an instance implementing the IObjectID interface which is used by the runtime to manage the persistent object's identity. When the class has only one identity field, one of the predefined classes that implement the IObjectID interface is used. At the moment such classes are available only for the types that are listed in the message of the error you got. In case of multiple identity fields, the object id class is automatically generated as a nested class in the persistent class, thus allowing you to have any combination of identity field types. So in your case, in order to have an object id class with one field of type DateTime, you can use a multiple field identity but have only one field - your DateTime primary key. This way the corresponding nested class will be generated in the persistent class.
To achieve that, please open the .rlinq file with an xml editor and replace this node:
<orm:identity>
    <orm:single-field field-name="timestamp" />
</orm:identity>
with the one below:
<orm:identity>
    <orm:multiple-field class-name="YourNamespace.YourClassName+ID">
        <orm:single-field field-name="timestamp" />
    </orm:multiple-field>
</orm:identity>
Where YourNamespace is the namespace of the persistent class and YourClassName is its name.
Reopen the diagram in the designer and click Save to execute the code-generation process. Then you should be able to build the project and work with this persistent class as expected.

We are aware that this workaround is not very elegant and we will put effort to improve this area of the product for the next Q. Hope that helps.

Greetings,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
SteveL
Top achievements
Rank 2
answered on 15 Jul 2010, 04:25 PM
Thank you, Alexander, that works just fine.

Steve
0
David Pusch
Top achievements
Rank 1
answered on 21 Sep 2010, 04:21 PM
Would this be an issue that will be addressed in the Q3 2010 release?
0
Alexander
Telerik team
answered on 23 Sep 2010, 04:00 PM
Hello David Pusch,

Our plans are to make bigger changes in this area, probably even removing the ID classes but this will most likely not make it for Q3. As there is a relatively easy workaround for this issue, it is not considered high priority. We are sorry for the inconvenience.

Best wishes,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Getting Started
Asked by
SteveL
Top achievements
Rank 2
Answers by
Alexander
Telerik team
SteveL
Top achievements
Rank 2
David Pusch
Top achievements
Rank 1
Share this question
or