Thursday, February 25, 2010

AJAX WCF Services with JSON and XML

Ajax WCF Service using GET /POST Method

The WebGetAttribute attribute is applied to the Add operation to ensure that the service responds to HTTP GET requests. The code uses GET for simplicity (you can construct an HTTP GET request from any Web browser). You can also use GET to enable caching. We can also add the WebInvokeAttribute attribute to explicitly specify HTTP POST, or not specify an attribute, which defaults to HTTP POST.
[ServiceContract(Namespace = "MyAjaxService")]
public interface ICal
{ [OperationContract]
[WebGet]
double Add(double x1, double x2); }

You can create an AJAX endpoint on the service by using the webHTTPBinding standard binding and the enableWebScript behavior in the service configuration file.
The enableWebScript behavior sets the default data format for the service to JSON instead of XML as shown below.
to change the Serializer
[OperationContract]
[WebInvoke(ResponseFormat=WebMessageFormat.Xml)]
//WebMessageFormat.JSon for Json Serializer
Public string HelloWCF()
{ Return “Hello WCF” }

For client follow any one of the technic
Add an ASP.NET AJAX Endpoint with out using Configuration
or
Use configuration to add an AJX Endpoint.

Tuesday, February 9, 2010

WSS Featues & it's Scope

A feature is like a site definition: a directory containing CAML-based XML files and page templates. The Feature is a container of various defined extensions for SharePoint.
Features provide the following capabilities:

  • Pluggable behavior for installing or uninstalling Features within a deployment.
  • Pluggable behavior for activating or deactivating Features at a given scope.

Features can be activated on an existing site. For example, we can create a feature that defines a custom list type, an instance of that list type, and an event handler or workflow on that list instance. Once the feature has been installed, it can be activated in any site within a farm and you can activate it through the WSS user interface, from the command line, or through custom code written against the WSS object model. Once the feature has been activated, the site will include the new custom list and any behavior we want to attach to it.
Location:
Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES

Scope & Accessibility

Site Scope
Only available for the root site of a site collection and is not displayed in the sub sites, Available only on the Site Collection Features page, accessible from the Site Actions menu.

Web Scope
Available on every web site including the root of the site collection

Web Application Scope
Available to all sites in all site collections of the web application and they can be activated and deactivated from Central Administration > Application Management > Manage Web Application Features.
Farm Scope
Available to all web application in the Farm level. Accessible from Central Administration > Operations > Managers Farm Features.

Monday, January 11, 2010

Understanding and Creating Customized and Uncustomized Files

Good article on MSDN to refresh basics of SharePoint site and application pages and what happens behind the scenes.

Thursday, May 21, 2009

Hibernate and IBatis

Recently i have got a chance to work with these following DB middle-wares with .NET.
Hibernate is a powerful, high performance object/relational persistence and query service.It helps to develop persistent classes folowing object-oriented idiom including association, inheritance, polymorphism, composition and collections. Hibernate allows to express queries in it's own portable SQL extension (HOL) as well as in native SQL.
IBatis Data maper framework makes it easier to use a DB with .NET and Java applications.IBatis couples objects with stored procedures or SQL statements using XML descriptor.
IBatis
-simpler
-fast development time
-flexible
-much smaller in package size.
Hibernate
-generate SQL for us for means we no need to spend time on SQL
-provide much more advance cache
-scalable
For more details
http://ibatis.apache.org/
https://www.hibernate.org/

Sunday, April 26, 2009

XslCompiledTransform and XslTransform

XslCompiledTransform and XslTransform
The .NET Framework 2.0 provides a new System.Xml.Xsl.XslCompiledTransform XSLT processor class, which is intended to replace the obsoleted XslTransform class. One of the major differences between the two is that while the latter is an XSLT interpreter, the former is a real XSLT compiler, allowing significantly faster execution times.
Sample code
xslt = new XslCompiledTransform();
xslt.Load(xslFile);

Does it mean XslCompiledTransform is always faster? Surprisingly, the answer is not that simple.
After doing some of my experiments, I came to the following conclusion
• If you are using one of the .NET Framework 2.0 XSLT processors (XslTransform or XslCompiledTransform), NGen'ing the System.Data.SqlXml assembly may improve the application start-up time.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>ngen install "System.Data.SqlXml, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" /nologo
Installing assembly System.Data.SqlXml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Compiling 1 assembly:
Compiling assembly System.Data.SqlXml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 ...
System.Data.SqlXml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
• Most of the times XslCompiledTransform.Load is slower than XslTransform.Load. But when you take concern about the over all performance XslCompiledTransform class is 4 times faster as MS says.
• While XslCompiledTransform is a best choice for the "one Load, many Transforms" scenario, it may be slow for the "one Load, one Transform" scenario, especially for very simple XML/XSLT files and when stylesheet templates are executed only few times. In those cases XslTransform may be faster.
• It is important, especially for server applications, to cache an XslCompiledTransform instance if the same stylesheet is likely to be executed again.