Friday, December 17, 2010

Rx.NET

Rx- Is the new Library in .NET Framework to compose asynchronous and event based programs into Observable Collections. Rx also called Reactive Extensions. Rx Library comes in 3 flavors one for .NET 4.0, Silverlight and JavaScript. you can download and installed from the following link

http://msdn.microsoft.com/en-us/devlabs/ee794896

Pull Vs Push [ Interactive vs Reactive]

IEnumerable and IEnumerator   Pull-Based Collection

IObservable<T> and IObserver<T>. Push Based Collections

image

Duality

image

image

Next Blog Post we will see some sample programs using RX Framework.

Nandri(Thanks)

SreenivasaRagavan.

Tuesday, December 7, 2010

Using IXmlSerializable Interface to serialize Private Members or properties

Suppose let say we have a UDT(User Defined Type) object called person which has the following property's Name,Phone and SSN. Here SSN is read-only properties. When you serializing this person object you get the following error.because XmlSerializer wont serialize the Private members.

image 

To serialize the person object we can implement the  IXmlSerializable Interface as shown below..

image 

Now if you try serialize it will be serialized as XML with out error.

image

Here is the result

image

Nandri(Thanks)

Sreenivasaragavan

Sunday, December 5, 2010

Silverlight 5.0 mainly for LOB Apps and Rich media solutions

The Silverlight 5 beta will be available sometime in 2011 H1, and more information will be available at http://www.microsoft.com/silverlight/

Silverlight 5 introduces more than 40 new features, including support for running Silverlight applications with desktop features in the browser, dramatic video quality and performance improvements, and features that improve developer productivity.

Microsoft_Silverlight

Nandri(Thanks)

Sreenivasaragavan.

Saturday, December 4, 2010

Using ASP.NET Routing Instead of .svc file When Hosting WCF RESTful Service in IIS

 

ASP.NET Routing are generally used because they give you more control over your URI’s . Now let see how we can use this Routing to host WCF RESTful Service.

1) Create a WCF Service Application

2) Delete the .svc file

3) Now add  the following <serviceHostingEnvironment  aspNetCompatibilityEnabled="true" />to web.config file.

Next you need to  decorate the your class as shown below.

image

Now add Global.asax file to your Service Project and define the One Private method called RegisterRoutes.

image

Now call this method in Application_Start.

image

Now you can browse the service  as  http://localhost:5018/SreeniRestSvc

Nandri(Thanks)

Sreenivasaragavan.

Sunday, October 24, 2010

Using AppFabric (Velocity) Caching API in WCF Service.

One of the best way to improve Application performance is to Cache Data which is frequently Accessed or Retrieved from Database so that we can  reduce the trip to Database and we can minimize or avoid the DB operations. MS Velocity offers in-memory caching.  In this blog I am going to show how to cache the some of the frequently access the data .

In this Exercise I am going to use  MS Free Database Chinook (Album ) as my data model. This Database has bunch of tables but I wanted to cache Customer and Album Tables. Here I am going to create WCF Service which expose to operations which returns list of  All Albums and All Customers.  Before creating WCF service I wanted to give brief introduction on  the Caching API’s we are going to use. Here I am going to use the following two Caching Services APIs

image

To Add Reference to our WCF project we need select it from  GAC ( Global Assembly Cache ). we can not add reference like other Assembly .  GAC is nothing but a  windows  file Folder which is created when you install .NET Framework and its  located  @ C:\Windows\Assembly  to add reference

image 

Here is the Caching API’s Classes and Methods which we will be using in our code.

image 

Here I am going to define the WCF Service which exposes two operations  GetAllAlbums and GetAllCustomers 

image

Here is the Caching Library implementation

image

 

image

using PowerShell Cmdlet we can verify our cache services  first let is check our Cache Host using  “Get-CacheHost”

image 

Get-Cache will displays the Cache Names

image

Get-CacheStatistics will give you the details about Cached item and Request Count etc..

image

Next Blog post we will see how to set Caching services in Web.config

Nandri( Thanks)

SreenivasaRagavan.

Saturday, October 23, 2010

Windows Server AppFabric–Caching Service

Windows AppFabric is set of technologies which offer to Hosting Services and Caching Services. In this blog post I am going show how to Install and Use  Caching Services. Windows AppFabric offers in memory caching with Distributed and Multi cluster supports . Windows AppFabric  aka “Velocity”.

There is two way you can install Windows AppFabric

1) Using Microsoft Web installer[http://www.microsoft.com/web/gallery/install.aspx?appsxml=http://www.microsoft.com/web/webpi/2.0/EnterpriseProductList.xml&appid=AppFabric]

2) You can download the bits from the following URL and Install http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=467e5aa5-c25b-4c80-a6d2-9f8fb0f337d2

Once you download and Run the Installer when you get to this screen where you will be configuring  Caching Service.

image

After installing you will the following Features added to IIS Manager

image

First we need to set Caching Service Configuration provider here you have two options one is  XML provider another options is  SQL Server .  This is just to store Caching Services Details like how many machines (Servers) in the cluster and their port numbers as shown below.  I like to mention here one thing  Windows AppFabric services wont store any Cache data in Database.

image

Here I choose XML is my Service Configuration provider so the configuration file stored in Network file share . Once you successfully installed. we can verify the Installation of Caching Services.   First Launch the  Power Shell Admin tool for Cache Services. 

Now Type “Get-Cachehost” this command will tells the service Status .

image

Here I have created two CacheName  Ragavan & Sreeni

image

image

To got Help for  all Cmdlet you can type Get-Help *

image

Next Blog post  we are going to use Caching API to store and retrieve data from Cache .

Thanks (Nandri)

Sreenivasa Ragavan

Sunday, October 3, 2010

MSDN Magazines

I Like to read MSDN Monthly Magazine and having a digital copy  in locally makes me great.  If you feel the same way I do  please point your browser to the following URL and Download  New and Old Magazines 

http://msdn.microsoft.com/en-us/magazine/ee412244.aspx

image

Nandri(Thanks)

SreenivasaRagavan

Friday, September 17, 2010

Building Windows Phone 7 Application .

In this blog Post I am going to build small Windows Phone Twitter Search Application . When we finish building then app this is how it looks

image 

Here is the steps we are going to follow .

1) Create VS.NET 2010  Windows Phone Application .

2) Build XAML UI.

3) We are going to parse that result using  LINQ TO XML.

4) Write Button click Event handler which will execute the  Twitter Search API and  get the  ATOM format Result.

5) Store the result in our Model  (Class which holds the  following properties Date published, Title, Image Uri).

6) Bind to the  View.

First  lets  create  a windows phone 7  Application project and  name it  TWAPP.

image

The following  XAML code builds  Textbox and Search button  where  user enter  search string and click Search button.

image

Next  we are going  construct the XAML which shows the  user Search result .

image

Here is our  MODEL

image

 

image

In Silverlight all calls to out side world is ASYNC.  Now we finished building the app and ready to compile and run .

image 

Now  enter the  some search string an click search button.

image

 

Nandri(Thanks)

Sreenivasaragavan.

Thursday, September 16, 2010

MS Windows Phone 7 Developer Tool RTM Released today

Today MS  Released  Windows Phone  Developer  Tool .  To  develop Windows Phone  7  Apps.

please point your Browser to  the following URL and Download the tool. http://developer.windowsphone.com/windows-phone-7/ 

image

Windows Phone 7  Application different Project Templates.

 

image

My First Windows Phone 7 App.

image

 

Nandri(Thanks)

SreenivasaRagavan

Wednesday, September 15, 2010

MS Today Released IE 9.0 Beta

Here is the URL to Download  http://windows.microsoft.com/en-US/internet-explorer/products/ie-9/home?os=win7&arch=b&browser=ie

 

image

 

My  Blog browsed using IE  9.0

image

Nandri(Thanks)

SreenivasaRagavan.

How to Debug .NET Framework Source Code

In this blog post I am going to show how to setup VS.NET Environment to step into .NET Framework source code. To do this exercise let us create small VS.NET Application and add some code which uses any of the .NET Framework Library Functions here I am using LINQ.  

 

image

This below source code just returns the even numbers from integer array and prints into Console .

image

Right click on the project and make sure you uncheck the  Enable the Visual Studio hosting process option as shown below.

image

Now go to Tools option from main menu and select Options as shown below.

image

Now set the options as shown below.

image

 

image

Now press F11 and debug the app. ( First time you can see the Dialog windows which shows downloading the .NET Framework Symbol )

image

When I hover over evennumbers variable I could able to see the source code life for that  as shown above. Now we are able to debug the .NET Framework source code same we do with our Custom code.

Nandri(Thanks)

SreenivasaRagavan.

Friday, August 27, 2010

Building Applications for MS Touch devices using Microsoft® Surface® Toolkit for Windows Touch Beta

To get started on this first go ahead and download the following 

Microsoft® Surface® Toolkit for Windows Touch Beta SDK

http://www.microsoft.com/downloads/details.aspx?FamilyID=801907A7-B2DD-4E63-9FF3-8A2E63932A74&amp;displaylang=en&displaylang=en 

Once you installed you will see the following Template .   Building Application for  Surface devices is same as Building Windows WPF Application .

image

let is try creating sample application . Here I am going to use ScatterView control

The ScatterView control as a container for any other user interface (UI) element. When you place a UI element inside of a ScatterView control, that element automatically gains the ability to be moved, rotated, and resized using one or multiple touches.

 

image

Here is the Result for the above XAML code in  MS Surface Simulator

image

Please download MS Surface SDK and explore the more controls .

Nandri(Thanks)

SreenivasaRagavan.