DateDiff suggestions

Skip to first unread message

Jordi Cabré

Nov 4, 2016, 7:58:12 AM11/4/16
to re-motion Users
I've implemented a DSL on my server. So, currently I'm sending transformed Linq expressions and translated to DSL syntax over the network.

Currently, it's came me up a trouble and there are running on my mind several apporaches to solve it.

I need to get the difference between two dates (entity field, or constant) in hours, minutes, seconds, days, months, years...

What would be your approach taking in mind it has to be able to run over objects.

Any suggestions?

Michael Ketting

Nov 4, 2016, 8:39:26 AM11/4/16
to re-motion Users
Hi Jordi!

In our SQL Backend, we use the available DateTime operations and translate them into SQL. You can hook up ExpressionTransformers via ExpressionTransformerRegistry. It's also possible to define custom (extension) methods and annotate them with the MethodCallExpressionTransformerAttribute.

I'm not sure I get your 'able to run over objects' caveat so it might not be a straight forward as I imagine. Generally speaking, I always try to keep one side as close to the object on which the processing is to be performed as possible to make it easier to translate the statement into the target language.

Best regards, Michael
Reply all
Reply to author
0 new messages