EverCrest Message Forums
You are not logged in. Login or Register.
Author
Topic: C# question
diadem
eet bugz
posted 06-07-2013 11:05:12 AM
You know how in WCF you can specify KnownType to support polymorphisim? How do you do that in workflow foundation?
play da best song in da world or me eet your soul
Blindy.
Suicide (Also: Gay.)
posted 06-08-2013 08:25:06 AM
I don't know what you are talking about but if you post some code it might help
Blindy.
Suicide (Also: Gay.)
posted 06-08-2013 10:00:37 PM
After reading your post on something awful I think you might want to consider that wcf and wwf serialize every thing and you really sold be dealing with the messages as service contracts and not business objects with logic.

can always use something like auto mapper to turn a message into a logical object when the properties are similar.

diadem
eet bugz
posted 06-10-2013 09:22:32 AM
quote:
Blindy. had this to say about Optimus Prime:
After reading your post on something awful I think you might want to consider that wcf and wwf serialize every thing and you really sold be dealing with the messages as service contracts and not business objects with logic.

can always use something like auto mapper to turn a message into a logical object when the properties are similar.


I found a workaround.

Workflow Foundation allows you to drag and drop visual boxes of flowcharts and state machines. One of the boxes represent a web request. It automatically creates a web-service and WSDL behind the scenes for you.

The idea of service contracts and such is a WCF concept, not a WF concept.

I'm not getting what you are trying to say here.

The original problem, simplified was this:

I have a list of animals. In WCF the list of animals can be rabbits, cows, etc under the hood. This is because if you have a list strongly typed to an abstract base class the contents of this list can be child classes under the hood. It's basic polymorphisim.

When you send items over the wire, you need WCF to generate a WSDL explaining what the properties are being sent down. Since the original list is of animals, but bunnies may have a property called HopHeight while a fish and other children not (they'd have there own), there is no way by default for the generator to know how to handle this in the WSDL. By using the known type attribute you can specify "by animal I mean walrus, cat, abbit, dog, shark..." and allow the WSDL to explain the possible data being returned.

WCF allows this by, as you stated earlier, dividing everything into core concepts.

WF is like drawing with crayons. It has the "don't worry about this, we'll take care of it for you" approach. I'm not defining a contract with WF like with WCF. I'm dragging a picture of box into a bigger picture and allowing the system to automatically generate a WSDL for me.

If there is a way to create a datacontract for a WF project like WCF I'd love to hear it, but how this is done was essentially the question in the first place.

edit: The workaround was allowing WF to receive requests while sending replies with technologies such as WCF or SignlaR which allow for more granular setting.

edit2: Stupidly on my part, I did this before manually testing to see if WF supports WCF attributes such as datacontract and datamember. Very embarrassing mistake on my part, regardless of what the actual outcome is.

diadem fucked around with this message on 06-10-2013 at 09:36 AM.

play da best song in da world or me eet your soul
Blindy.
Suicide (Also: Gay.)
posted 06-12-2013 12:43:53 PM
I've never been enamored with WWF, mainly because I find code easier to read than flowcharts, and WCF is like code attribute hell (I use servicestack.net fwiw), but from an approach standpoint when I've had to send a payload with a variable type which can be expected to be known by both sender and receiver, I generally inlude a field on the message for the fully qualified type name and serialize the playload into a second field, then the receiver can use refection to re-construct the payload into the business object.

You still have the situation that your reconstituted object can only be dealt with on the receiving side (initially) as an ancestor class (object or animal or whatev) or an interface, but there are some fairly obvious techniques that can allow you to inspect the object and deal with it appropriately.

I've done something similar where my client needed to dynamically generate a form for the user to fill in details on a process- the server would send a packet that would say something to the effect of "You'll need a INT, call it Run Time (Minutes), and accept values between 0 and 500", and the client would then construct an instance of int to bind the control to while using the other information to set up the labels and dynamic validation.

All times are US/Eastern
Hop To: