Friday, December 13, 2013

Reset Identity

DBCC CHECKIDENT can reseed (reset) the identity value of the table. For example, YourTable has 25 rows with 25 as last identity. If we want next record to have identity as 35 o Run following T SQL script in Query Analyzer.
DBCC CHECKIDENT (‘table_name’, reseed, 34)
If identity seed is set below values that currently are in table, it will violate the uniqueness constraint as soon as the values start to duplicate and will generate error.

Friday, December 6, 2013

OperationContract

WCF uses an opt-in model to define what belongs to one of its contracts. In a service contract interface, only methods decorated with [OperationContract] are exposed to the client. That means that, in the interface below, if used within a WCF service, a client could call both Add and Subtract operations, but not Multiply.
[ServiceContract]
public interface ICalculator
{
    [OperationContract]
    int Add(int x, int y);

    [OperationContract]
    int Subtract(int x, int y);

    // Not decorated
    int Multiply(int x, int y);
}


There are two overload of OperationContract one is without parameter and other is with parameter.

Parameters are

Action → Gets or sets the WS-Addressing action of the request message.
AsyncPattern  → Indicates that an operation is implemented asynchronously using a Begin and End method pair in a service contract.HasProtectionLevel → Gets a value that indicates whether the messages for this operation must be encrypted, signed, or both.
IsInitiating → Gets or sets a value that indicates whether the method implements an operation that can initiate a session on the server (if such a session exists).
IsOneWay → Gets or sets a value that indicates whether an operation returns a reply message.
IsTerminating → Gets or sets a value that indicates whether the service operation causes the server to close the session after the reply message, if any, is sent.
Name → Gets or sets the name of the operation.
ProtectionLevel → Gets or sets a value that specifies whether the messages of an operation must be encrypted, signed, or both.
ReplyAction →  Gets or sets the value of the SOAP action for the reply message of the operation.
TypeId → When implemented in a derived class, gets a unique identifier for this
Attribute. → (Inherited from Attribute.)

Followers

Link