Anyone thinking on making translators "specific"?

Topics: Service Factory Modeling Edition Forum
Jan 22, 2009 at 11:22 AM

We are facing the challenge that we have a DataType called Meter. Meter has the following properties to keep it simple:
MeterNumber (String)
Status (StatusType)
Capacity (String)

We use this DataType for several services. In one occasion we want to translate our entire business object to the DataType.Meter object. But we have requirements where we only wish to translate e.g. MeterNumber.
So we are looking for a way to "tell" our translator what we want to have filled at the service layer side.

I hope my story is clear enough ;)
Any ideas, opinions, comments?
Jan 22, 2009 at 1:14 PM

I would say that you keep all your knowledge in your business logic, so all knowledge what parts of an object should be sent back to a 'caller' should also exist there. This means that your translators can stay as 'dumb' as possible. The only thing you'll need is for your translators to be able to handle a non-filled in field and for your DataContract to allow/specify this as well.

Your Service layer would then (always) be as simple as Translate the incoming object(s), call the appropriate function on the business logic and, if necessary, translate the result back and return... (obviously with appropiate error handling where required, but you get the idea).

Just my two cents...