Wrox Programmer Forums
|
BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6
This is the forum to discuss the Wrox book Professional Microsoft Robotics Developer Studio by Kyle Johns, Trevor Taylor; ISBN: 9780470141076
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Microsoft Robotics Studio ISBN: 978-0-470-14107-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2008, 09:09 PM
Registered User
 
Join Date: Jun 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default New operation types

Hello,

I am trying to put an service together with a need to instantiate a new service operation, similar to the example shown on page 95.

The operation that I am creating is based on an Query operation, and per the example, I am trying to return a class which is part of the state.

However, when I attempt to return a type which is part of my service _state, I get compilation errors.

For example, the code from pg 95 shows:

public class QueryInfrared : Query<SensorsRequest, Portset<Sensors, Fault>>
{
}

What is the scope of the Sensors class? Is it defined in the _state ? If so, how can the above PortSet have knowledge about it if is defined in another class?

I've looked through the Hemmisson code and I can't seem to find the answer...

Thanks,
Scott

 
Old June 30th, 2008, 05:14 AM
Wrox Author
 
Join Date: Apr 2008
Posts: 60
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Oops! That one slipped past the Technical Editor!

The code on page 95 is from an early version of the Hemisson code before I decided to change it over to use the Generic Brick in Chapter 17. (It was originally a separate example in Chapter 16).

Anyway, to answer your question, the Sensors class should be in the HemissonTypes.cs file (don't bother looking in the Hemisson code -- it's not there). It must be declared as a public class, and the trick is that it must have the [DataContract] attribute, which you can see on the SensorsRequest class on page 95.

In fact, both the request and the response classes must have the [DataContract] attribute. When DssProxy creates the Proxy DLL, it recognizes this attribute and transfers the class definitions across to the proxy code so that other services can find these data types.
When you set up a reference to the Proxy DLL from your own service, your code finds out about these request/response types.

There is nothing to stop you using a public class with the [DataContract] attribute inside the state. In the original Hemisson code there was a public member in the state with the Sensors data type.

While we are on the subject, if you want the members of a class to be visible you not only have to declare them as public, you also have to mark them with [DataMember]. Have a look at GenericBrickState.cs in Chapter 17.

Trevor







Similar Threads
Thread Thread Starter Forum Replies Last Post
operation not yet implemented RichardMaly Crystal Reports 11 January 8th, 2013 02:22 PM
calculation operation vinny07 Excel VBA 0 March 1st, 2007 06:32 AM
JOIN operation U.N.C.L.E. SQL Language 8 July 10th, 2006 06:52 AM
OPeration must be updated khzahid Classic ASP Basics 1 April 27th, 2005 06:01 PM
Types DARSIN Oracle 2 February 5th, 2005 12:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.