In WCF programming we frequently deal with some concepts
such as Service Contract, Data Contract, Message Contract and Service Operation
on the service side.
Each of these concepts has a corresponding concept in object
oriented programming and we will use them to implement our WCF concepts.
Usually we use an Object Oriented concept and mark it with an attribute to
build our WCF concept.
These are some examples: Service Contract, Data Contract and
Message Contract are implemented as interface. For Service Contract we use
ServiceContract, for Data Contract we use DataContract and for Message Contract
we use MessageContract attributes.
In previous articles I mentioned that there are three
approaches in WCF programming:
·
Declarative
·
Imperative
·
Configuration Based
And also I mentioned that normally we use a combination of
these three approaches to build our WCF applications.
The declarative part of WCF programming is where we mark our
classes, methods and interfaces with attributes to build WCF concepts.
Imperative part is where we write programming code logic for our applications
and Configuration is where we configure our applications, define service
endpoints, behaviors, etc.
We have three levels of programming in WCF (from top to
down):
·
Typed Services: We write services like our Object Oriented
applications and use methods and functions to get parameters and return results
in simple and complex data types.
·
Untyped Services: We write services to use messages as parameters
and returns types rather than simple or complex types.
·
Messaging-Layer: In this level we come down to the lowest level and
directly work with messages. Here you need to code for many details of your
application. One common example of this level is writing intermediaries.
Well, I think theories are getting boring. Let us discover
our example to cover much of these theories.