This question is locked. New answers and comments are not allowed.
I'm working with Time type in SQL Server, and when I map this field to OpenAccess it creates a DateTime field. Is there any way to map this as TimeSpan?
Thanks
Thanks
7 Answers, 1 is accepted
0

Chris
Top achievements
Rank 1
answered on 24 Oct 2013, 02:01 AM
I'm having the same issue. Using MySQL's time data type gets interpreted as DateTime. I can manually change the generated code to be c# TimeSpan type but anytime I change the rlinq map it gets overwritten.
0
Accepted
Hi Christian,
Regards,
Ady
Telerik
After generating the domain model from the database you can select the particular property in the designer and change the CLR type of this property to 'TimeSpan' in the properties window. 'TimeSpan' is not listed there but you can just type it in.
Querying for data should then give you TimeSpan values.
Regards,
Ady
Telerik
OpenAccess ORM Q3 2013 Beta is available for immediate download in your account. Get it now and play with the latest bits. See what's new >>
0

Chris
Top achievements
Rank 1
answered on 24 Oct 2013, 02:37 PM
Thanks Ady! That worked. It wasn't one of the options in the drop down but I see now you can free type your CLR data type. Great stuff.
0

Christian
Top achievements
Rank 1
answered on 25 Oct 2013, 01:37 PM
Thanks Ady, it worked!
Do I have to change it every time I regenerate the Domain Model?
Do I have to change it every time I regenerate the Domain Model?
0
Hi Christian,
Ady
Telerik
Glad to know that it works for you.
No, you do not need to set it every time. Its like any other property - you need to set it only once.
Ady
Telerik
OpenAccess ORM Q3 2013 simplifies your model operations even further providing you with greater flexibility. Check out the list of new features shipped with our latest release!
0

Evo
Top achievements
Rank 1
answered on 08 Oct 2014, 11:32 PM
Hi Ady,
I'm having troubles when SaveChanges is called with TimeSpan (the field is mapped in the database as Time)
Additional information: Insert of 'xxxx-' failed: Telerik.OpenAccess.RT.sql.SQLException: Operand type clash: int is incompatible with time
Statement(s) could not be prepared. ---> System.Data.SqlClient.SqlException: Operand type clash: int is incompatible with time
Is there something I'm not mapping correctly?
Thanks in advance.
I'm having troubles when SaveChanges is called with TimeSpan (the field is mapped in the database as Time)
Additional information: Insert of 'xxxx-' failed: Telerik.OpenAccess.RT.sql.SQLException: Operand type clash: int is incompatible with time
Statement(s) could not be prepared. ---> System.Data.SqlClient.SqlException: Operand type clash: int is incompatible with time
Is there something I'm not mapping correctly?
Thanks in advance.
0
Hi Evaristo,
I was able to reproduce the error and have created a bug entry for the same. Unfortunately there is no workaround for this problem.
You can use the 'System.DateTime' as the CLR type for a 'time' column or map the 'TimeSpan' field to a 'datetime' column.
Regards,
Ady
Telerik
I was able to reproduce the error and have created a bug entry for the same. Unfortunately there is no workaround for this problem.
You can use the 'System.DateTime' as the CLR type for a 'time' column or map the 'TimeSpan' field to a 'datetime' column.
Regards,
Ady
Telerik
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.