Saturday, 24 September 2016

dml statements in sql

DML


Data Manipulation Language (DML) statements are used for managing data within schema objects. Some examples:
  • SELECT - retrieve data from the a database
  • INSERT - insert data into a table
  • UPDATE - updates existing data within a table
  • DELETE - deletes all records from a table, the space for the records remain
  • MERGE - UPSERT operation (insert or update)
  • CALL - call a PL/SQL or Java subprogram
  • EXPLAIN PLAN - explain access path to data
  • LOCK TABLE - control concurrency

ddl statements in sql

ddl statements in sql

DDL


Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples:
  • CREATE - to create objects in the database
  • ALTER - alters the structure of the database
  • DROP - delete objects from the database
  • TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
  • COMMENT - add comments to the data dictionary
  • RENAME - rename an object

Friday, 2 September 2016

as operator in c#

abstract in c#

abstract (C# Reference)

The abstract modifier indicates that the thing being modified has a missing or incomplete implementation. 
The abstract modifier can be used with classes, methods, properties, indexers, and events. 
Use the abstract modifier in a class declaration to indicate that a class is intended only to be a base class of other classes. 
Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class.


abstract class ShapesClass
{
    abstract public int Area();
}
class Square : ShapesClass
{
    int side = 0;

    public Square(int n)
    {
        side = n;
    }
    // Area method is required to avoid
    // a compile-time error.
    public override int Area()
    {
        return side * side;
    }

    static void Main() 
    {
        Square sq = new Square(12);
        Console.WriteLine("Area of the square = {0}", sq.Area());
    }

    interface I
    {
        void M();
    }
    abstract class C : I
    {
        public abstract void M();
    }

}
// Output: Area of the square = 144

Wednesday, 24 August 2016

contracts in wcf with Real Time example

WCF Architecture

WCF has a layered architecture that offers ample support for developing various distributed applications. The architecture is explained below in detail.
WCF Architecture

Contracts

The contracts layer is just next to the application layer and contains information similar to that of a real-world contract that specifies the operation of a service and the kind of accessible information it will make. Contracts are basically of four types discussed below in brief:
  • Service contract - This contract provides information to the client as well as to the outer world about the offerings of the endpoint, and the protocols to be used in the communication process.
  • Data contract - The data exchanged by a service is defined by a data contract. Both the client and the service has to be in agreement with the data contract.
  • Message contract - A data contract is controlled by a message contract. It primarily does the customization of the type formatting of the SOAP message parameters. Here, it should be mentioned that WCF employs SOAP format for the purpose of communication. SOAP stands for Simple Object Access Protocol.
  • Policy and Binding - There are certain pre-conditions for communication with a service, and such conditions are defined by policy and binding contract. A client needs to follow this contract.

Service Runtime

The service runtime layer is just below the contracts layer. It specifies the various service behaviors that occur during runtime. There are many types of behaviors that can undergo configuration and come under the service runtime.
  • Throttling Behavior - Manages the number of messages processed.
  • Error Behavior - Defines the result of any internal service error occurrence.
  • Metadata Behavior - Specifies the availability of metadata to the outside world.
  • Instance Behavior - Defines the number of instances that needs to be created to make them available for the client.
  • Transaction Behavior - Enables a change in transaction state in case of any failure.
  • Dispatch Behavior - Controls the way by which a message gets processed by the infrastructure of WCF.
  • Concurrency Behavior - Controls the functions that run parallel during a client-server communication.
  • Parameter Filtering - Features the process of validation of parameters to a method before it gets invoked.

Messaging

This layer, composed of several channels, mainly deals with the message content to be communicated between two endpoints. A set of channels form a channel stack and the two major types of channels that comprise the channel stack are the following ones:
  • Transport Channels - These channels are present at the bottom of a stack and are accountable for sending and receiving messages using transport protocols like HTTP, TCP, Peer-to-Peer, Named Pipes, and MSMQ.
  • Protocol Channels - Present at the top of a stack, these channels also known as layered channels, implement wire-level protocols by modifying messages.

Activation and Hosting

The last layer of WCF architecture is the place where services are actually hosted or can be executed for easy access by the client. This is done by various mechanisms discussed below in brief.
  • IIS - IIS stands for Internet Information Service. It offers a myriad of advantages using the HTTP protocol by a service. Here, it is not required to have the host code for activating the service code; instead, the service code gets activated automatically.
  • Windows Activation Service - This is popularly known as WAS and comes with IIS 7.0. Both HTTP and non-HTTP based communication is possible here by using TCP or Namedpipe protocols.
  • Self-hosting - This is a mechanism by which a WCF service gets self-hosted as a console application. This mechanism offers amazing flexibility in terms of choosing the desired protocols and setting own addressing scheme.
  • Windows Service - Hosting a WCF service with this mechanism is advantageous, as the services then remain activated and accessible to the client due to no runtime activation.

Tuesday, 23 August 2016

WCF Versus Web Service

WCF Versus Web Service

There are some major differences that exist between WCF and a Web service which are listed below.
  • Attributes - WCF service is defined by ServiceContract and OperationContract attributes, whereas a web service is defined by WebService and WebMethod attributes.
  • Protocols - WCF supports a range of protocols, i.e., HTTP, Named Pipes, TCP, and MSMQ, whereas a web service only supports HTTP protocol.
  • Hosting Mechanisms - Various activation mechanisms are there for WCF hosting, i.e., IIS (Internet Information Service), WAS (Windows Activation Service), Self-hosting and Windows Service, but a web service is hosted only by IIS.
  • Services - WCF supports a robust security, trustworthy messaging, transaction and interoperability, while a web service only supports security services.
  • Serializer - WCF Supports DataContract serializer by employing System.Runtime.Serialization, whereas a web service supports XML serializer by making use of System.Xml.Serialization.
  • Tools - ServiceMetadata tool (svcutil.exe) is used for client generation for a WCF service, while WSDL.EXE tool is used for generating the same for a web service.
  • Exception Handling - In WCF, unhandled exceptions are handled in a better way by making use of FaultContract. They do not return to the client like in a web service as SOAP faults.
  • Hash Table - It is possible to serialize a Hash Table in WCF, but this is not the case in a web service.
  • Bindings - WCF supports several types of bindings like BasicHttpBinding, WSDualHttpBinding, WSHttpBinding, etc., while a web service supports only SOAP or XML.
  • Multithreading - WCF supports multithreading by using the ServiceBehavior Class, whereas this is not supported in a web service.
  • Duplex Service Operations - WCF supports duplex service operations apart from supporting one-way and request-response service operations, whereas a web service does not support duplex service operations.

Saturday, 13 August 2016

RavenDB - Overview

RavenDB - An Introduction

RavenDB - An Introduction

Introduction

RavenDB is a new open source document database for .NET. If you have never worked with a document database before, the simplest way to think about it is to imagine serializing your objects and storing them on the hard drive where the app is. If you stored it using the key or whatever most common lookup method you might use, it would be quite easy to retrieve your entire object without having to map to and from columns and rows in a SQL database. Dealing with further ways of looking it up, concurrency, etc. would be more difficult to deal with, hence the creation of document databases. The documents stored don't necessarily need to be an object that is serialized (arbitrary documents can be stored independent of objects), but that is probably the most common way it can be used. Just keep in mind that it is a completely different way of dealing with data storage so you probably don't want to always approach it as you would a SQL database. A .NET client is included for communicating with the server but the underlying representation is HTTP/JSON - so any client that can communicate with the server via HTTP/JSON will work.

Simple Example

RavenDBIntro/simpleexample2.jpg
Here is a simple example of how to store two arbitrary POCO objects in RavenDB, query for them and print out some of the information to the screen. In this example, the RavenDB server is on the same machine as the client but that doesn't have to be the case (more on that next). Notice that I didn't have to create a table, I didn't have to map columns and classes to the tables and I didn't have to create any stored procedures. The Company class isn't even marked as Serializable - it just works.
Also keep in mind that the creation of a DocumentStore object should be treated as an expensive operation, similar to creating a session factory in NHibernate. Currently it isn't but there is future work planned that may change this.

Configure a Host Header for a Web Site (IIS)

How to host asp net application on the web server IIS

How to Install

Thursday, 11 August 2016

WCF - Overview

Fundamental Concepts of WCF

Fundamental Concepts of WCF

Message

This is a communication unit that comprises of several parts apart from the body. Message instances are sent as well as received for all types of communication between the client and the service.

Endpoint

It defines the address where a message is to be sent or received. It also specifies the communication mechanism to describe how the messages will be sent along with defining the set of messages. A structure of an endpoint comprises of the following parts:

  • Address - Address specifies the exact location to receive the messages and is specified as a Uniform Resource Identifier (URI). It is expressed as scheme://domain[:port]/[path]. Take a look at the address mentioned below:

    net.tcp://localhost:9000/ServiceA

    Here, 'net.tcp' is the scheme for the TCP protocol. The domain is 'localhost' which can be the name of a machine or a web domain, and the path is 'ServiceA'.

  • Binding - It defines the way an endpoint communicates. It comprises of some binding elements that make the infrastructure for communication. For example, a binding states the protocols used for transport like TCP, HTTP, etc., the format of message encoding, and the protocols related to security as well as reliability.

  • Contracts - It is a collection of operations that specifies what functionality the endpoint exposes to the clinet. It generally consists of an interface name.


WCF - Overview

WCF stands for Windows Communication Foundation. The elementary feature of WCF is interoperability. It is one of the latest technologies of Microsoft that is used to build service-oriented applications. Based on the concept of message-based communication, in which an HTTP request is represented uniformly, WCF makes it possible to have a unified API irrespective of diverse transport mechanisms.

WCF was released for the first time in 2006 as a part of the .NET framework with Windows Vista, and then got updated several times. WCF 4.5 is the most recent version that is now widely used.

A WCF application consists of three components:

  • WCF service,
  • WCF service host, and
  • WCF service client.

WCF platform is also known as the Service Model.