ViewModel as return value of domain service

2014-09-23 Thread Vladimir Nišević
Hi everybody, here my second question today.

I need to provide a domain service which handles multiple elasticsearch and
database queries and builds a non persistent domain object and gives that
as a response to the 3rd party client thru REST API.

So my idea is to define a ViewModel classes representing my non-persistent
domain model and use them as method return value of a domain service. In a
domain service method I would make those elasticsearch and database queries
and then build and provide that object as a return value.

It seems that ViewModel cannot be returned thru REST API?

BR,Vladimir


Re: ViewModel as return value of domain service

2014-09-23 Thread Dan Haywood
Um, it certainly is the intention that view models can be returned from the
REST API, but was just double checking this before answering, and it seems
that there is a bug in 1.6.0.  Apologies for that.

Looks like the fix is easy enough, and I need to put out a 1.6.1 release
anyway to address some security issues raised recently, so will look to
incorporate the fix into that.

So your idea is sound; I'll report back when made some progress.

Ta
Dan


On 23 September 2014 15:39, Vladimir Nišević vnise...@gmail.com wrote:

 Hi everybody, here my second question today.

 I need to provide a domain service which handles multiple elasticsearch and
 database queries and builds a non persistent domain object and gives that
 as a response to the 3rd party client thru REST API.

 So my idea is to define a ViewModel classes representing my non-persistent
 domain model and use them as method return value of a domain service. In a
 domain service method I would make those elasticsearch and database queries
 and then build and provide that object as a return value.

 It seems that ViewModel cannot be returned thru REST API?

 BR,Vladimir