Creating Services

    • The [OperationContract] attribute is applied to a method indicating that the method implements a service operation as part of a service contract. This attribute should be defined before each method specified in a WCF application code.
    • The TransactionTimeout property of the [ServiceBehavior] attribute gets or sets the time in the format “HH:MM:SS” within which a transaction must complete.
    • The [Service Contract] attribute is used to an interface or a class to define a service contract in a WCF application.
    • The TransactionFlowOption enumeration specifies the transaction flow policy for a service operation. It is used with the TransactionFlow attribute that specifies whether a service operation accepts incoming transactions from a client. The OperationBehaviorAttribute.TransactionAutoComplete property gets or sets a value to indicate whether the current transaction scope has been automatically completed if no unhandled exceptions occur.
    • Uploading the XML file in as a stream will work better for uploading large files. Streams can load large amounts of data, or large files that are read into most programs. Therefore, you should create the following operation contract:
      [OperationContract()] void UploadFile(Stream xmlData)
    • In order to handle complex data types, you should use the [KnownType(typeof())] attribute with the data contract. The [KnownType] attribute is specifically meant to be used with structures, classes, interfaces, and other complex data types.

Pass MCTS: Microsoft Visual Studio 2008 in a first attempt:

Continue reading