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

Why calculated column is created in table?

3 Answers 31 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jose Mejia
Top achievements
Rank 1
Jose Mejia asked on 08 Oct 2013, 09:43 AM
Hi.

I've sqlite backend and OA version is 2013.2.702.1. I created calculated column and updated db from model and mentioned that
calcualted column is persisted in table. Why it is so? I supposed that calculated column is transient, as it's name suggests. I mean it has sense only when instance of row in memory. Or it has to be calculated in db, that why it should be persistent?

My scenario is extend OA entity with additional fields that should be calculated based on persistent, say I've got persisten wkb geo format, but based on this value I want  to have wkt and geojson format. What would you suggest to me in this case: simply extend orm class with my additional fields and custom logic or use some OA mechanisms?

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Accepted
Boris Georgiev
Telerik team
answered on 11 Oct 2013, 09:50 AM
Hi Jose,

The transient properties are properties that will not have corresponding columns in the database and one property is transient if its not added in the model. On the other side, the computed columns in the database have corresponding properties in the model which are Persistent Read-Only, because they are calculated in the database and you cannot insert value for them.

For your case, if you do not want to save the values in the database and then get the calculated ones, the better option is to extend the class with a transient property, where the calculated logic will be executed.

I hope that helps.

Regards,
Boris Georgiev
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
Jose Mejia
Top achievements
Rank 1
answered on 14 Oct 2013, 03:22 PM
Ok, thank you!

Few more question:
1)why it is not possible to configure transient property via OA model designer (I'm using sqlite as backend)?
2)related to your links, do you consider Transient attribute obsolete?
3)am I right that  additional (hand-written) fields in partial class have the same semantics as transient field?
   Or they are different because OA runtime is aware about transient fields (via attributes or another way) and
   hand-written properties aren't in scope of OA runtime?
0
Accepted
Boris Georgiev
Telerik team
answered on 17 Oct 2013, 03:07 PM
Hi Jose,

You can find the answers on your questions below:

1) Every property which is not in the OpenAccess model can be considered as transient.
2) If you are not using OpenAccess Clasic Mapping, the transient attribute is obsolete.
3) When the additional(hand-written) property is not in the OpenAccess model then OpenAccess runtime doesn't know that this property is existing, on the other side, the OpenAccess runtime knows that the transient property is existing, but also knows that the property is not in the mapping.

I hope that helps.

Regards,
Boris Georgiev
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 >>
Tags
General Discussions
Asked by
Jose Mejia
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Jose Mejia
Top achievements
Rank 1
Share this question
or