Thursday, May 27, 2010

SOA Characteristic

SOA characteristics are defined below:

  • Service are discoverable and dynamically bound
  • Service provider use service registry to register service and Service consumer will use Service Registry to find out proper service and consume it. For an example, financial provider gives facility to validate credit card information and register their service with the system registry. They also provide more information like charges to validate credit card information. Service consumer will find all the services which helps to validate the credit card information and choose provider who gave service at lowest price.
  • Services are self contained and modular
  • Most important aspect of SOA is concept of modularity. A service supports a set of interfaces. These interfaces should be cohesive, meaning that they should all relate to each other in the context of a module.
  • Services stress interoperability
  • The ability of system is to be consumed by different platforms and languages to communicate with each other. Services dependencies are loose-coupled means loose-coupled services have a few well known dependencies.
  • Service have a network-addressable interface
  • The role of the network is central to the concept of SOA. A service must have a network-addressable interface. A consumer on a network must be able to invoke a service across the network. The network allows services to be reused by any consumer at any time. The ability for an application to assemble a set of reusable services on different machines is possible only if the services support a network interface.
  • Service have coarse-gained interfaces
  • The concept of granularity applies to services in two ways. First, it is applied to the scope of the domain the entire service implements. Second, it is applied to the scope of the domain that each method within the interface implements. The levels of granularity are relative to each other. For instance, if a service implements all the functions of a banking system, then we consider it coarsegrained. If it supports just credit-card validation, we consider it fine-grained. In addition, if a method for inquiring about a customer returns all customer information, including address, this method would be coarser-grained than a method that does not return the customer’s address.
  • Services are location transparent
  • Location transparency is a key characteristic of service-oriented architecture. Consumers of a service do not know a service’s location until they locate it in the registry. The lookup and dynamic binding to a service at runtime allows the service implementation to move from location to location without the client’s knowledge. The ability to move services improves service availability and performance. By employing a load balancer that forwards requests to multiple service instances without the service client’s knowledge, we can achieve greater availability and performance.
  • Services are composable
  • A service’s composability is related to its modular structure. Modular structure enables services to be assembled into applications the developer had no notion of when designing the service. Using preexisting, tested services greatly enhances a system’s quality and improves its return on investment because of the ease of reuse. A service may be composed in three ways: application composition, service federations, and service orchestration. An application is typically an assembly of services, components, and application logic that binds these functions together for a specific purpose. Service federations are collections of services managed together in a larger service domain. For example, a checking account service, savings account service, and customer service may be composed into a larger banking-account service. Service orchestration is the execution of a single transaction that impacts one or more services in an organization. It is sometimes called a business process. It consists of multiple steps, each of which is a service invocation. If any of the service invocations fails, the entire transaction should be rolled back to the state that existed before execution of the transaction.
  • Service-oriented architecture supports self-healing.
  • With the size and complexity of modern distributed applications, a system’s ability to recover from error is becoming more important. A self-healing system is one that has the ability to recover from errors without human intervention during execution.

Truncate vs Delete

To remove data from database table, we can use Truncate or Delete command on database table.

There are many difference in Truncate and Delete command:

1. Clause:
You can specify where clause to remove some data in Delete command. like:

Delete from Table1 where ID > 20

You can't specify where cluase with Truncate command. Truncate command will remove all the data from table.

2. Transaction:
Delete command is a part of transaction. So you need to commit your transaction to make changes permanent.
Truncate command is not participate in transaction. So you don't required to do anything with transaction.

3. Trigger:
Delete command will fire delete trigger of the table. Truncate command will not fire any trigger.

4. Log:
SQL server logs information regarding delete operation. So everytime log file increased when you will execute delete command. SQL server do not log any information regarding Truncate operation. So Truncate operation is faster than Delete operation.

5. Identity Value:
Truncate reset identity value if table have any identity column. Delete operation not reset any identity value.

Remove duplicate rows in SQL Server

Sometime we face problem of duplicate records in SQL server database. In this scenario, we need to remove duplicate rows.

There are many ways available to remove duplicate rows from the database like
  • Using temporary table – In this you have to transfer data into temporary table which have identity column so you can identify record uniquely and remove duplicate rows. But it gives more loads on SQL if you have lots of data in your table.
  • Using adding Identity column into existing database

All above options gives very heavy load to SQL server. You can remove duplicate rows using following method:
You just have to create in-memory table which just create schema of your table and add new row number column. Using row number column, you can remove duplicate rows.

With [Temp_Table_Name] as
Select RN = row_number() over (PARTITION by col1, col2, col3 order by col1, col2, col3), * from [Table_Name]

delete from [Temp_Table_Name] where RN > 1

The above script add new column of row number in your table. This is just in-memory change. You can remove duplicate rows which actually remove from your table.

Here I used Row_Number function with “Order by” and “Partition by”.

Wednesday, May 26, 2010

Toolbox Item missing for SSRS Reporting project

When you open SSRS reporting project in Business Intelligence studio, you can view different tool available in your toolbox (make sure your report file is open in IDE). Sometime you will get only Textbox control multiple times instead of different controls.

Come out from this problem, you have to remove some temporary files which load Toolbox. You can get these file on following location:

%userprofile%\Local Settings\Application Data\Microsoft\VisualStudio\9.0

You have to remove following files from the above path:

  • toolbox.tbd
  • toolbox_reset.tbd
  • toolboxIndex.tbd
  • toolboxIndex_reset.tbd

After removing files, you have to reset the toolbox. It will take time to reset the Toolbox. After reseting, you will get all the controls available in SSRS project.

DotNet Code Guru