WCF

WCF Examples

WCF

WCF Projects

WCF Project

adplus-dvertising
DataTableHelper.ToArray( )
Previous Home Next

DataTableHelper.ToArray ( )

DataTableHelper used for add some type safety . at compile time, DataTableHelper places constraints on the type parameter R to be a data row and at runtime, the method returns an empty array if the table is empty.

DataTableHelper.ToArray( ) use the myCollection helper class to invoke the converter on every row in the table, converting every row to a single Contact and returning the resulted array and It verifies that the type parameter T is decorated either with the DataContract attribute or the Serializable attribute.

Instance Management:

Instance managementis the name for a set of techniques used by WCF to bind client requests to service instances, governing which service instance handles which client request.

Behaviors

Behavior is a local attribute of a service that does not affect its communication patterns. Clients should be unaware of behaviors, and behaviors do not manifest themselves in the service's binding or published metadata.

Type of Behaviors:

Two type of behaviors

  1. ServiceBehaviorAttribute
  2. OperationBehaviorAttribute
  1. ServiceBehaviorAttribute

    The ServiceBehavior attribute is used to configure the service instance mode.

    Example of The ServiceBehaviorAttribute used to configure instance context mode

    public enum InstanceContextMode
    {
       PerCall,
       PerSession,
       Single
    }
    [AttributeUsage(AttributeTargets.Class)]
    public sealed class ServiceBehaviorAttribute : Attribute,...
    {
       public InstanceContextMode InstanceContextMode
       {get;set;}
       //More members
    }
    
  2. OperationBehaviorAttribute

    The OperationBehaviorAttribute is used to configure operation behaviors, and it can be applied only on a method that implements a contract operation, never on the operation definition in the contract itself.

Previous Home Next