Thursday, June 23, 2011

Miscellaneous Notes

To blogged

jQuery does not work when one meta tag is missing for a list item of ddl


Technopark Express

http://www.technoparktoday.com/technopark-guide/technopark-express-timings/

Wednesday, June 22, 2011

WCF - Intro

Windows Communication Foundation

New References

http://msdn.microsoft.com/en-us/library/dd456779.aspx


1. A service is a construct that exposes one or more endpoints, each of which exposes one or more service operations.

2. The endpoint of a service specifies an address where the service can be found, a binding that contains the information that a client must communicate with the service, and a contract that defines the functionality provided by the service to its clients

3. The SIX tasks need to create a WCF application

3.1. Define a WCF Service Contract

3.2. Implement a WCF Service Contract

3.3. Host and Run a Basic WCF Service

3.4. Create a WCF Client

3.5. Configure a Basic WCF Client

3.6. Use a WCF Client

1. Define a WCF Service Contract

1. The first task is to define a contract.

2. The contract specifies what operations the service supports

3. An operation can be thought of as a Web service method

4. Contracts are created by defining a C++, C#, or Visual Basic (VB) interface. Each method in the interface corresponds to a specific service operation. Each interface must have the ServiceContractAttribute applied to it and each operation must have the OperationContractAttribute applied to it. If a method within an interface that has the ServiceContractAttribute does not have the OperationContractAttribute, that method is not exposed.

2. Implement WCF Service Contract

1. Implement the created contract.

3. Host and Run the WCF Service

1. Create host and run the service.

3. Host and Run the WCF Service

Create the Proxy and Configuration file using ServiceModel MetaData Utility Tool

References

Ø http://msdn.microsoft.com/en-us/library/ms734712.aspx

Tuesday, June 21, 2011

The double question mark operator in C#

The operator '??' is called null-coalescing operator, which is used to define a default value for a nullable value types as well as reference types.

It is useful when we need to assign a nullable variable a non-nullable variable. If we do not use it while assigning, we get an error something like

Cannot implicitly convert type 'int?' to 'int'. An explicit conversion exists (are you missing a cast?)

To overcome the error, we can do as follows...

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace GenConsole
{
class Program
{

static void Main(string[] args)
{
CoalescingOp();
Console.ReadKey();
}

static void CoalescingOp()
{
// A nullable int
int? x = null;
// Assign x to y.
// if x is equal to null, then y = x. Otherwise y = -33(an integer selected by our own choice)
int y = x ?? -33;
Console.WriteLine("When x = null, then y = " + y.ToString());

x = 10;
y = x ?? -33;
Console.WriteLine("When x = 10, then y = " + y.ToString());

}
}
}


Output
-------