<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Welcome to Baskar&#039;s blog</title>
	<atom:link href="http://baskaronline.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://baskaronline.wordpress.com</link>
	<description>Microsoft platform code bits &#38; tips</description>
	<lastBuildDate>Sun, 05 Jun 2011 14:41:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='baskaronline.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/17e2b214e2a36622dca898c1fab70337?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Welcome to Baskar&#039;s blog</title>
		<link>http://baskaronline.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://baskaronline.wordpress.com/osd.xml" title="Welcome to Baskar&#039;s blog" />
	<atom:link rel='hub' href='http://baskaronline.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Webservices &#8211; Rest Vs Soap</title>
		<link>http://baskaronline.wordpress.com/2011/06/01/webservices-rest-vs-soap/</link>
		<comments>http://baskaronline.wordpress.com/2011/06/01/webservices-rest-vs-soap/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 19:07:20 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=115</guid>
		<description><![CDATA[There are two approaches for interfacing to the web with web services, namely SOAP (Simple Object Access Protocol) and REST (Representational State Transfer). Both approaches work, both have advantages and disadvantages to interfacing to web services, but it is up to the web developer to make the decision of which approach may be best for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=115&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There are two approaches for interfacing to the web with web services, namely SOAP (Simple Object Access Protocol) and REST (Representational State Transfer).<br />
Both approaches work, both have advantages and disadvantages to interfacing to web services, but it is up to the web developer to make the decision of which approach may be best for each particular case.</p>
<p>When to Use What:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Areas where SOAP based WebServices is a great solution:<br />
   If application needs a guaranteed level of reliability and security<br />
   If both sides (provider and consumer) have to agree on the exchange format<br />
   If the application needs state management </p>
<p>Areas where RESTful WebServices are a great choice:<br />
  Return structure is really in any format (developer defined).<br />
  Any browser can be used because the REST approach uses the standard GET, PUT, POST, and DELETE verbs.<br />
  REST can also use the XMLHttpRequest object &#8211; AJAX support<br />
  If you need stateless operations like CRUD (Create, Read, Update, and Delete) then REST is suitable.<br />
  If the application information needs to be cached.</p>
<p>Differences:<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
REST defines a transport-Specific (HTTP) model, focused on RESOURCES<br />
sOAP defines a transport-Neutral (HTTP/TCP/SMTP/MSMQ) model, focused on CUSTOM OPERATIONS</p>
<p>REST emphasizes NOUNs (with REST, you define resources and use a Uniform Interface to operate on them using GET/PUT/DELETE/POST)<br />
SOAP emphasizes VERBs (with SOAP, you define operations which tunnels through POST)</p>
<p>REST =&gt; Employee{}<br />
        EmpAddress{}<br />
SOAP =&gt; getEmployee(), addEmployee(), RemoveEmployee(),<br />
        getEmpAddress(),addEmpAddress(),&#8230;</p>
<p>REST is used in highly-scalable Web-centric scenarios<br />
SOAP is used in Enterprise scenarios (where you need COM+ like capabilities)<br />
REST is focused on accessing named resources //getUser(User);<br />
SOAP is focused on accessing named operations //switchCategory(User, OldCategory, NewCategory)</p>
<p>REST exposes data as services<br />
SOAP exposes application logic as services and not data</p>
<p>REST permits many different data formats. JSON is used to handle different data formats.<br />
SOAP only permits XML</p>
<p>REST doesn&#8217;t deal will standard messaging system and expects the clients to deal with it<br />
SOAP provides end-to-end reliability using WS-ReliableMessaging.</p>
<p>REST uses only HTTP/HTTPS protocol<br />
SOAP uses multiple protocol &#8211; SMTP (Simple Mail Transfer Protocol) and even JMS (Java Messaging Service).</p>
<p>REST is limited by HTTP, it can’t provide two-phase commit across distributed transactional resources.<br />
  General Internet apps don’t need this level of transactional reliability<br />
SOAP supports WS-AtomicTransaction, thats ACID compliant.  Enterprise level/ Financial apps needs SOAP.</p>
<p>REST provides transactions, but they aren&#8217;t ACID compliant<br />
SOAP provides ACID compliant transactions</p>
<p>REST reads can be cached<br />
SOAP reads cannot be cached.</p>
<p>REST supports SSL(point to point) security<br />
SOAP supports WS-Security providing enterprise security features</p>
<p>Note:<br />
&#8212;&#8212;&#8211;<br />
 REST can do just about anything SOAP can, but without established standards. </p>
<p> Yahoo, Amazon and Ebay uses REST for their services.</p>
<p> Google used only SOAP but in 2006 they deprecated to REST.</p>
<p>Thanks to Mike Rozlog  &amp; Steve Francia for there presentations.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=115&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2011/06/01/webservices-rest-vs-soap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
		<item>
		<title>MVC models</title>
		<link>http://baskaronline.wordpress.com/2011/05/11/mvc-models/</link>
		<comments>http://baskaronline.wordpress.com/2011/05/11/mvc-models/#comments</comments>
		<pubDate>Wed, 11 May 2011 20:35:48 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=104</guid>
		<description><![CDATA[One of the motivations of using the MVC pattern is to make the model independent from of the views. Since there is no direct dependency from the model to the view, the user interface can display multiple views of the same data at the same time. For example, 1.Multiple pages in a Web application may [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=104&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the motivations of using the MVC pattern is to make the model independent from of the views.<br />
Since there is no direct dependency from the model to the view, the user interface can display multiple views of the same data at the same time.<br />
For example,<br />
1.Multiple pages in a Web application may use the same model objects.<br />
2.Web application that allows the user to change the appearance of the pages</p>
<p>In MVC comes with two models<br />
1.Passive model<br />
2.Active model</p>
<p>Passive model: Used when one controller manipulates the model exclusively. The controller modifies the model and then informs the view that the model has changed and should be refreshed (see Figure 2). The model in this scenario is completely independent of the view and the controller, which means that there is no means for the model to report changes in its state<br />
The HTTP protocol is an example of this. The browser displays the view and responds to user input, but it does not detect changes in the data on the server. Only when the user explicitly requests a refresh is the server interrogated for changes<br />
 <img src="http://baskaronline.files.wordpress.com/2011/05/mvcmod1.jpg?w=450" /><br />
Active model: Used when the model changes state without the controller&#8217;s involvement. This can happen when other sources are changing the data and the changes must be reflected in the views. Consider a stock-ticker display. You receive stock data from an external source and want to update the views  when the stock data changes. Because only the model detects changes to its internal state when they occur, the model must notify the views to refresh the display.<br />
<img src="http://baskaronline.files.wordpress.com/2011/05/mvcmod2.jpg?w=450" /></p>
<p>If the model had to notify the views of changes, you would reintroduce the dependency you were looking to avoid. Fortunately, the Observer pattern  provides a mechanism to alert other objects of state changes without introducing dependencies on them</p>
<p>The individual views implement the Observer interface and register with the model. The model tracks the list of all observers that subscribe to changes. When a model changes, the model iterates through all registered observers and notifies them of the change. This approach is often called &#8220;publish-subscribe.&#8221; The model never requires specific information about any views.</p>
<p>Architecting the presentation layer around the MVC pattern results in the following advantages: Supports multiple views and Accommodates GUI change</p>
<p>Disadvantages: •<br />
Since its event-driven nature of  the user-interface code, which can become more difficult to debug.<br />
Developers of the model can ignore the nature of the views. If the model undergoes frequent changes, it could flood the views with update requests. Therefore, it is important to keep the view in mind when coding the model.<br />
Observer. Is a pattern that is often mentioned in conjunction with MVC due to the need to keep the views and the associated model synchronized. </p>
<p>Page Controller and Front Controller describe implementation strategies for the controller portion of the MVC pattern.</p>
<p>Page Controller<br />
How do you best structure the controller for Simple Web applications so that you can achieve reuse and flexibility while avoiding code duplication?</p>
<p>Use the Page Controller pattern to accept input from the page request, invoke the requested actions on the model, and determine the correct view to use for the resulting page. The view in turn depends on the model for retrieval of data to be displayed<br />
 <img src="http://baskaronline.files.wordpress.com/2011/05/mvcmod3.jpg?w=450" /></p>
<p>Defining a separate page controller isolates the model from the specifics of the Web request. Creating a separate controller for each Web page (or action) can lead to significant code duplication. Therefore, you should create a BaseController class to incorporate common functions such as validating parameters.<br />
<img src="http://baskaronline.files.wordpress.com/2011/05/mvcmod4.jpg?w=450" /></p>
<p>Disadvantages: One controller per page, Deep inheritance trees, code duplication</p>
<p>Front Controller<br />
How do you best structure the controller for Very Complex Web applications so that you can achieve reuse and flexibility while avoiding code duplication? </p>
<p>Front Controller solves the decentralization problem present in Page Controller by channeling all requests through a single controller. The controller itself is usually implemented in two parts: a handler and a hierarchy of commands<br />
 <img src="http://baskaronline.files.wordpress.com/2011/05/mvcmod5.jpg?w=450" /><br />
<img src="http://baskaronline.files.wordpress.com/2011/05/mvcmod6.jpg?w=450" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=104&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2011/05/11/mvc-models/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/mvcmod1.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/mvcmod2.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/mvcmod3.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/mvcmod4.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/mvcmod5.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/mvcmod6.jpg" medium="image" />
	</item>
		<item>
		<title>Brainstroming on MVC &#8211; MVP &#8211; MVVM</title>
		<link>http://baskaronline.wordpress.com/2011/05/10/brainstroming-on-mvc-mvp-mvvm/</link>
		<comments>http://baskaronline.wordpress.com/2011/05/10/brainstroming-on-mvc-mvp-mvvm/#comments</comments>
		<pubDate>Tue, 10 May 2011 15:25:43 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=77</guid>
		<description><![CDATA[Goal: The major issues associated with GUI design is 1. maintain state of the application 2. complicated logic to handle / manipulate GUI controls 3. data synchronization (between UI controls and business objects) Due to these factors the UI gets bloated with cluttered code. Code maintenance too becomes a big headache. Presentation logic should not [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=77&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Goal:</strong><br />
The major issues associated with GUI design is<br />
1. maintain state of the application<br />
2. complicated logic to handle / manipulate GUI controls<br />
3. data synchronization (between UI controls and business objects)</p>
<p>Due to these factors the UI gets bloated with cluttered code.<br />
Code maintenance too becomes a big headache.</p>
<p>Presentation logic should not decide what to show to the user. So let’s split this into two layers.<br />
The Presentation layer should receive user input and display output.<br />
The Application layer should make calls to the model and decide what to show to the user</p>
<p><strong>General Terms (Optional):</strong><br />
Data lies in the database is called &#8220;RecordState&#8221;.<br />
Data lies within the application (in-memory) is called &#8220;Session Set&#8221;.<br />
Data lies within the GUI Controls are called &#8220;ScreenState&#8221;.<br />
To keepScreenStateandSessionStatesynchronized we use Data Binding concept.<br />
Data Binding handles much of the functionality of a client-server application.<br />
Forms are responsible for Screen Layout and Form Logic.<br />
Form observes the controls its holds.<br />
Form has handler methods to react to events raised by the controls we are interested with.<br />
Simple data changes are handled through data binding, whereas complex changes are handled using form&#8217;s event handling methods.</p>
<p><strong>MVC.</strong><br />
The main purpose of the controller class is to map the action to the view after loading the model. (Whereas when loading home page no model object is required)<br />
So the controller role is to load the model and call the view.<br />
Controller uses ViewData to make the model available to view.<br />
In MVC, it is not allowed to access the view directly, therefore the model (business object) changes are propagated to view through the observer mechanism. (using presentation model).<br />
Therefore in order to make the view update itself, the controller should change the presentation model object (not the actual business model objects). Controller cannot simply send a message to the view.<br />
To implement this, make the model OBSERVABLE and make the view OBSERVER. Thus whenever the business objects (model) changes it notifies the views automatically.<br />
Each OBSERVER is registered with OBSERVABLE.<br />
In general controller calls write methods on model objects and similarly view calls read methods on model objects to update the view.<br />
In this scenario, each write method in observable (model) calls a notification method in each observer (view).Notification method in observer reads model<br />
(Observers may have multiple observerables with common notification method. Notification method parameter indicates which observable.)</p>
<p>Application Flow: When user makes an update on the screen, the user inputs are passed to the controller, which in turn calls Write method on model object. Now the model object in turn calls the notification method on the view which in turn calls the read method on model object. Thus the view gets updated automatically when model changes.</p>
<p>View only renders the presentation model and presents them to the user. In MVC, view does not contain any complex or application logic.</p>
<p>In MVC, the View doesn’t speak to Controller or Model directly. Everything happens here through Presentation Model classes.</p>
<p>The Data Binding between Controller and View takes place using &#8220;ViewData&#8221; Concept</p>
<p>View access the model using ViewData object<br />
[Controller]  &#8212;&gt; [ViewData] &#8212;-&gt; [View]<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;Model&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&gt;</p>
<p><strong>Drawbacks of MVC:</strong><br />
1.  Higher implementation complexity involved because of observer mechanism. Harder to understand and maintain code (due to indirect linking of controller to view through presentation object)<br />
2.  Direct requests from the controller to view is not possible<br />
3.  MVC does not conform to modern UI programming environments. Ex. Form classes in .NET application by default contains handlers for user inputs.<br />
     It would be difficult to break that default pattern and make controllers to receive the user input instead of views.<br />
4.While implementing we need to introduce a new class called Presentation model.</p>
<p><strong>Advantages:</strong><br />
1. MVC provides a clear distribution of responsibilities between parties. Keep application logic and UI code in separate classes.<br />
2. Since view in MVC does not contain any application logic, controller can load the model in different views with easy.<br />
3. One model can have multiple views and controller pairs.</p>
<p><strong>When to use MVC:</strong><br />
1. If the application is more report oriented where diferent reports can be shown using same ASPX page but with different models.<br />
    So if your application has same UI with some slight variation MVC is a good fit.<br />
Mapping is done at RegisterRoutes() method. {Default/controller/action/id == http://localhost/Employee/ViewEmployeeSalesReport/001}</p>
<p>Simple Example for using ViewData concept( lets forget about Presentation model class here):<br />
public class EmployeeModel<br />
{<br />
     private int      _empid;<br />
     private string _strempname;<br />
     private string _customername;<br />
     private double _salesprofit;<br />
     public int EmpId{get; set;}<br />
    public string EmpName{get; set;}<br />
    public string CustomerName{get; set;}<br />
    public double SalesProfit{get; set&#8217;;}</p>
<p>    public void LoadCustomer(int empid)<br />
   {<br />
      //loads employee data from database based on empid<br />
   }<br />
};</p>
<p>public class EmployeeController : Controller<br />
{<br />
    public ActionResult ViewEmployeeSalesReport(string id)<br />
     {<br />
         EmployeeModel  objEmpModel = new EmployeeModel();<br />
         objEmpModel.LoadEmployeeDetails(id);<br />
          ViewData["Employee"] = objempModel;<br />
          return View();<br />
      }    <br />
}</p>
<p>public partial class ViewEmployeeSalesReport: ViewPage<br />
{<br />
    protected void Page_Load(object sender, EventArgs e)<br />
   {<br />
      datagrid1.DataSource = (EmployeeModel) ViewData["Employee"];<br />
      datagrid1.DataBind();<br />
   }<br />
}</p>
<p><strong>MVP.</strong><br />
 If your goal is to<br />
1. decouple model from view &amp;<br />
2. reuse presentation logic irrespective of the UI type (windows / web<br />
Then you have to choose MVP.<br />
MVP basically centralizes the presentation logic. Move this presentation logic to a separate class called PRESENTER.<br />
This also makes the UI testing simple. <br />
In MVP, the Controller makes direct calls to the View. (calling through Interface -IView)<br />
This allows developer to easily support interchangeable views for Web and Windows environments.<br />
In this model presenter can talk to view. (whereas in MVC, the controller cannot talk to view)<br />
In MVP, the Presenter always talks to the View through an interface. In this way the model is never in touch with the UI (aspx / windows interface). All user interface should implement this View interface so that the presenter can communicate with the UI in a decoupled manner.</p>
<p>The INotifyPropertyChanged interface is the key for data binding. If the data changes in the view models need to be reflected in the XAML components through bindings, all the view models in a Silverlight MVVM application need to implement this interface</p>
<p>In MVP views receive user input and then delegates processing to the corresponding controllers. That is why MVP pattern better fits modern UI environments (Windows/Web forms) where view classes themselves handle user inputs.</p>
<p>With the release of Silverlight 4, the Managed Extensibility Framework (MEF) became a first class citizen of the .NET Framework 4.0. MVVM  has quickly become the most popular pattern for developing Silverlight applications. The Managed Extensibility Framework (MEF) simplifies the creation of extensible applications. MEF can assist you with building dynamic, modular, extensible, testable applications faster than ever before</p>
<p><strong>Here</strong><br />
All user actions are passed to the Presenter,<br />
the UI is decoupled from the model.<br />
the Presenter is not tied up with the business objects<br />
<img src="http://baskaronline.files.wordpress.com/2011/05/one2.jpg?w=450" /><br />
<img src="http://baskaronline.files.wordpress.com/2011/05/two.jpg?w=450" /><br />
<img src="http://baskaronline.files.wordpress.com/2011/05/four.jpg?w=450" /></p>
<p>Implement StockBO, IStockView and Presenter as Class Library (dll) in C#<br />
namespace StockBO<br />
{<br />
    public class Stock<br />
    {<br />
        public static int intStockValue;</p>
<p>        public static void IncrementStock()<br />
        {<br />
            intStockValue++;<br />
        }<br />
        public static void DecrementStock()<br />
        {<br />
            intStockValue&#8211;;<br />
        }<br />
 public static int getStatus()<br />
        {<br />
            if (intStockValue &gt; 5)<br />
                return 1;<br />
            else if (intStockValue &lt; 0)<br />
                return -1;<br />
            else<br />
                return 0;<br />
        }<br />
    }<br />
}</p>
<p>namespace IStockView<br />
{<br />
   public interface StockView<br />
    {<br />
        void setStockValue(int intStockValue);<br />
        void setColor(System.Drawing.Color objColor);<br />
    }<br />
}</p>
<p>using IStockView;<br />
using StockBO; //Stock<br />
namespace Presenter<br />
{<br />
    public class clsPresenter<br />
    {<br />
 StockView iObjStockView;</p>
<p>        public void add(StockView ObjStockView)<br />
        {<br />
            iObjStockView = ObjStockView;<br />
        }</p>
<p>        public void increaseStock()<br />
        {<br />
            Stock.IncrementStock();<br />
            iObjStockView.setStockValue(Stock.intStockValue);<br />
            ChangeColor();<br />
        }</p>
<p>        public void decreaseStock()<br />
        {<br />
            Stock.DecrementStock();<br />
            iObjStockView.setStockValue(Stock.intStockValue);<br />
            ChangeColor();<br />
        }</p>
<p>        public void ChangeColor()<br />
        {<br />
            if(Stock.getStatus()==-1)<br />
                iObjStockView.setColor(Color.Red);<br />
            else if (Stock.getStatus() == 1)<br />
                iObjStockView.setColor(Color.Blue);<br />
            else<br />
                iObjStockView.setColor(Color.Green);<br />
        }<br />
    }<br />
}</p>
<p>//Add reference dlls (IStockView.dll, Presenter.dll)<br />
using IStockView;<br />
using Presenter;<br />
namespace WindowsMVPStock<br />
{<br />
    public partial class Form1 : Form,StockView<br />
    {<br />
        clsPresenter objpresenter = new clsPresenter();</p>
<p>        //Form Members<br />
 private void Form1_Load(object sender, EventArgs e)<br />
        {<br />
            objpresenter.add(this);<br />
        }</p>
<p>        private void btnInCreaseStock_Click(object sender, EventArgs e)<br />
        {<br />
            objpresenter.increaseStock();<br />
        }</p>
<p>        private void btnDecreaseStock_Click(object sender, EventArgs e)<br />
        {<br />
            objpresenter.decreaseStock();<br />
        }</p>
<p>	 //StockView Members<br />
	 public void setStockValue(int intStockValue)<br />
        {<br />
            txtStockValue.Text = intStockValue.ToString();<br />
        }</p>
<p>        public void setColor(Color objColor)<br />
        {<br />
            txtStockValue.BackColor = objColor;<br />
        }<br />
   }<br />
}</p>
<p>//Add reference dlls (IStockView.dll, Presenter.dll, StockBO.dll)<br />
using IStockView;<br />
using Presenter;<br />
public partial class DisplayStock : System.Web.UI.Page,StockView<br />
{<br />
    private clsPresenter objPresenter = new clsPresenter();</p>
<p>        //Form Members<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        objPresenter.add(this);<br />
    }<br />
    protected void btnIncreaseStock_Click(object sender, EventArgs e)<br />
    {<br />
        objPresenter.increaseStock();<br />
    }<br />
    protected void btnDecreaseStock_Click(object sender, EventArgs e)<br />
    {<br />
        objPresenter.decreaseStock();<br />
    }</p>
<p>    //StockView Members<br />
    public void setStockValue(int intStockValue)<br />
    {<br />
        txtStockValue.Text = intStockValue.ToString();<br />
    }<br />
    public void setColor(System.Drawing.Color objColor)<br />
    {<br />
        txtStockValue.BackColor = objColor;<br />
    }</p>
<p>} </p>
<p><strong>MVVM</strong><br />
MVVM is a specialized Design Pattern for WPF and Silverlight applications.<br />
In a WPF MVVM application, the Models will go through the View-Model classes to communicate with the Views (UI).<br />
This View-Model class inherits from the &quot;ViewModelBase&quot; class</p>
<p>If you want to create your own View-Models, you should also make your View-Model classes inherit from &quot;ViewModelBase&quot; class<br />
The &quot;ViewModelBase&quot; class implements the &quot;INotifyPropertyChanged&quot; interface, so the UI (View) will be notified when a public property bounded to it is changed.</p>
<p>One thing to remember about the view is that it is not responsible for maintaining its state. Instead, it will synchronize this with the viewmodel.</p>
<p>In MVVM. the views are expressed as XAML</p>
<p>In MVVM, the View and Model plays the same role as in MVC. The only difference here is the concept of ViewModel. This is an abstract representation of user interface class exposing both properties and operations that can be invoked from UI<br />
Unlike Contollers in MVC, Presenter in MVP, an MVVM ViewModel has no awareness that a view even exists. Instead MVVM view uses WCF/Silverlight binding features with allows you to associate bidirectionally the UI’s Control properties with the properties exposed by the ViewModel.</p>
<p>The whole MVVM pattern is designed around WCF/Silverlight binding’s features, so it does not always make sense to apply it on other technology platforms.</p>
<p><img src="http://baskaronline.files.wordpress.com/2011/05/five.jpg?w=450" /></p>
<p>First, the IConfig represents a configuration service (in a newsreader it may contain the account information and feeds that are being fetched), while the IService is &#8220;some service&#8221; &#8211; perhaps the interface to fetch feeds from RSS sources in a news reader application. </p>
<p>The View and the ViewModel </p>
<p>The view and the viewmodel communicate via data-binding, method calls, properties, events, and messages</p>
<p>The viewmodel exposes not only models, but other properties (such as state information, like the &#8220;is busy&#8221; indicator) and commands</p>
<p>The view handles its own UI events, then maps them to the viewmodel via commands</p>
<p>The models and properties on the viewmodel are updated from the view via two-way databinding<br />
Two mechanisms that often factor into implementations of the pattern are triggers (especially data triggers) in WPF, and the Visual State Manager (VSM) in Silverlight. These mechanisms help implement the pattern by binding UI behaviors to the underlying models.<br />
In Silverlight, the VSM should be the primary choice for coordination of transitions and animations</p>
<p>You might have heard discussion about view first or viewmodel first. In general, I believe most developers agree that a view should have exactly one viewmodel. There is no need to attach multiple viewmodels to a single view.<br />
A view may be composed of other views, each with its own viewmodel. Viewmodels might compose other viewmodels when necessary</p>
<p><strong>Dis-Advantages</strong><br />
The overhead in implementing MVVM is &#8220;overkill&#8221; for simple UI operations. For larger applications, generalizing the View layer becomes more difficult. Moreover, data binding, if not managed well, can result in considerable memory consumption in an application</p>
<p><strong>Advantages</strong><br />
One of the major claimed advantages of MVVM is that due to the separation of business data objects from the UI, we can simply change the UI without touching the business objects. It may be true in some circumstances when the changes to the UI are cosmetic changes. In practice, most of the changes to the UI due to business requirements will be functional changes. These changes will almost always require us to change the UI and the data objects together.</p>
<p><strong>References and pictures borrowed from:</strong></p>
<p>http://www.mvcsharp.org</p>
<p>Shivprasad koirala @ codeproject.com<br />
Dr. Song Li @ codeproject.com<br />
Jeremy likness @ csharperimage.jeremylikness.com</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=77&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2011/05/10/brainstroming-on-mvc-mvp-mvvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/one2.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/two.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/four.jpg" medium="image" />

		<media:content url="http://baskaronline.files.wordpress.com/2011/05/five.jpg" medium="image" />
	</item>
		<item>
		<title>REST &#8211; what and why</title>
		<link>http://baskaronline.wordpress.com/2011/04/29/rest-what-and-why/</link>
		<comments>http://baskaronline.wordpress.com/2011/04/29/rest-what-and-why/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 19:56:43 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=71</guid>
		<description><![CDATA[With REST you can build webservices without tears (ie, without SOAP or WSDL). Uses simple HTTP Protocol and XML message format. The Message can be viewed in a clever way using XSLT and CSS. REST &#8211; REpresentational State Transfer A Webpage is a representation of a resource. Resources are just concepts. URI&#8217;s tell a client [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=71&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>With REST you can build webservices without tears (ie, without SOAP or WSDL). Uses simple HTTP Protocol and XML message format.<br />
The Message can be viewed in a clever way using XSLT and CSS.</p>
<p>REST &#8211; REpresentational State Transfer<br />
A Webpage is a representation of a resource.<br />
Resources are just concepts.<br />
URI&#8217;s tell a client that there is a concept somewhere<br />
Clients can then request a specific representation  from the   representations the server makes available</p>
<p>Resources are retrieved NOT as string or blobs, but as complete representations.</p>
<p>Resources are identified by uniform resource indentifiers (URI&#8217;s)<br />
URI&#8217;s are equivalent to NOUN<br />
Verbs describe actions that are applicable to nouns<br />
Some verbs only apply to a few nouns</p>
<p>REST language has trillions of nouns<br />
In RESt we use universal verbs only<br />
There are only 4 verbs for every noun &#8211; GET, POST, PUT, DELETE<br />
PUT- is used to update information</p>
<p>Every useful data object has an address.Resources themselves are the targets for method calls. the list of methods is fixed for all resources.</p>
<p>Every URI could have a human-reable and a machin-processable representation<br />
 &#8211; webservices asks for machine readble one<br />
 &#8211; browser ask for human reable one</p>
<p>XmlHttpRequest object lets you to do REST from inside a webpage.</p>
<p>Advantages:<br />
HTTP, URIs and actual data resources acquired from URIs are sufficient to describe any complex transaction including<br />
 &#8211; session state<br />
 &#8211; applicaiton state (authentication /authorization)<br />
Enables transfer of data in streams of unlimited size and type<br />
Scales well to large number of clients<br />
Seperates server implementation from client perception of resources.<br />
REST Messages are self-descriptive and stateless. Therefore message must get application state included. Application state is required by the server to understand how to process a request.</p>
<p>REST vs RPC<br />
REST is a species of RPC, except the methods have been defined in advance<br />
Most RPC applications dont adhere to REST philosophy<br />
 Assume RPC call &#8220;getStockPrice&#8221; &#8211; it is not clear what it means.<br />
 This is not a resource.Its a verb, not a Noun<br />
  But if we change the name to &#8220;CurrentStockPrice&#8221; , now its a noun. A resource. Rest is just a design style not an architecture change.</p>
<p>REST is incompatible with &#8220;End Point&#8221; RPC concepts<br />
REST address data objects<br />
RPC address software components using End-Points (SOAP began as pure RPC)</p>
<p>Thanks to John Cowan for his presentation.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=71&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2011/04/29/rest-what-and-why/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
		<item>
		<title>About Immutable</title>
		<link>http://baskaronline.wordpress.com/2011/04/29/about-immutable/</link>
		<comments>http://baskaronline.wordpress.com/2011/04/29/about-immutable/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 17:19:53 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=69</guid>
		<description><![CDATA[Immutable means &#8220;cannot be modified after it is created&#8221;. •An immutable type has a constructor and getters but not setters. •A mutable type can also have setters. An example of an immutable type is DateTime =&#62;The method AddMinutes does not modify the object &#8211; it creates and returns a new DateTime. string =&#62; For a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=69&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Immutable means &#8220;cannot be modified after it is created&#8221;.<br />
•An immutable type has a constructor and getters but not setters.<br />
•A mutable type can also have setters.</p>
<p>An example of an immutable type is<br />
 DateTime =&gt;The method AddMinutes does not modify the object &#8211; it creates and returns a new DateTime.<br />
  string =&gt; For a mutable class similar to string you can use the class StringBuilder</p>
<p>There is no keyword in C# to declare a type as immutable. Instead you should mark all member fields as readonly to ensure that they can only be set in the constructor. This will prevent you from accidentally modifying one of the fields, breaking the immutability.</p>
<p>In practice, if you want to create an immutable type, you only allow getters on it and do not allow any state changes (so any private field cannot change once the constructor finished running).</p>
<p>Defining an immutable object with a C# class involves discipline in not changing the private state </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/69/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/69/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/69/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=69&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2011/04/29/about-immutable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
		<item>
		<title>Quick recap on Dependency Injection</title>
		<link>http://baskaronline.wordpress.com/2011/04/29/quick-recap-on-dependency-injection/</link>
		<comments>http://baskaronline.wordpress.com/2011/04/29/quick-recap-on-dependency-injection/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 16:34:22 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=63</guid>
		<description><![CDATA[Dependency Injection is also termed as Inversion of Control (IoC). Dependency Injection is a design pattern to implement loosely coupled, reusable and testable object thereby allowing the architecture to link objects rather than the object linking themselves. This design allows you to isolate the implementation of an object from the construction of objects on which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=63&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Dependency Injection is also termed as Inversion of Control (IoC).</p>
<p>Dependency Injection is a design pattern to implement loosely coupled, reusable and testable object thereby allowing the architecture to link objects rather than the object linking themselves.</p>
<p>This design allows you to isolate the implementation of an object from the construction of objects on which it depends.<br />
public class A ();<br />
public class B<br />
{<br />
A objA = new A();<br />
}</p>
<p>Why to use this design?<br />
Loose coupling, centralized configurable and easily testable.</p>
<p>Types of Dependency Injection?<br />
<strong> 1. Construction Injection</strong> interface IAuto {}<br />
public class BMW : IAuto(}<br />
public class Honda: IAuto{}<br />
public class Facade<br />
{<br />
private IAuto objAuto;<br />
public Facade(IAuto obj)<br />
{this.objAuto = obj;}<br />
}<br />
IAuto objbmw = new BMW();<br />
Facade objFacade = new Facade(objbmw); </p>
<p> Drawback:<br />
1. Once the class is instantiated you no loger change the<br />
objects dependency.<br />
2. Constructors dont get inherited</p>
<p><strong> 2. Setter Injection</strong> public class Facade<br />
{<br />
private IAuto autoType;<br />
public IAuto AutoType<br />
{<br />
get{return autoType;}<br />
set{autoType= value;}<br />
}<br />
}<br />
IAuto objbmw = new BMW();<br />
Facade objFacade = new Facade();<br />
objFacade.AutoType = objbmw;</p>
<p> Adv :<br />
You can change the dependency after instantiating an object .<br />
Drawback:<br />
 Object with setters cannot be immutable</p>
<p><strong>3. Interface-based Injection</strong> public class Facade<br />
{<br />
private IAuto autoType;<br />
public void SetAutoType( IAuto autoType)<br />
{<br />
this.autoType = autoType;<br />
}<br />
}<br />
IAuto objbmw = new BMW();<br />
Facade objFacade = new Facade();<br />
objFacade.SetAutoType(objbmw);</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=63&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2011/04/29/quick-recap-on-dependency-injection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET Fundamentals</title>
		<link>http://baskaronline.wordpress.com/2010/02/17/50/</link>
		<comments>http://baskaronline.wordpress.com/2010/02/17/50/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 21:34:22 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=50</guid>
		<description><![CDATA[When ASP.NET receives the first request for any resource in an application, a class named ApplicationManager creates an application domain. Application domains provide isolation between applications for global variables and allow each application to be unloaded separately. Within an application domain, an instance of the class named HostingEnvironment is created, which provides access to information [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=50&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://baskaronline.files.wordpress.com/2010/02/asp-fund.jpg"><img src="http://baskaronline.files.wordpress.com/2010/02/asp-fund.jpg?w=450" alt="" title="aspImage1"   class="alignright size-full wp-image-49" /></a><a href="http://baskaronline.files.wordpress.com/2010/02/asp-fund2.jpg"><img src="http://baskaronline.files.wordpress.com/2010/02/asp-fund2.jpg?w=450" alt="" title="aspfund2"   class="alignnone size-full wp-image-51" /></a></p>
<p>When ASP.NET receives the first request for any resource in an application, a class named ApplicationManager creates an application domain. Application domains provide isolation between applications for global variables and allow each application to be unloaded separately. Within an application domain, an instance of the class named HostingEnvironment is created, which provides access to information about the application such as the name of the folder where the application is stored</p>
<p>After the application domain has been created and the HostingEnvironment object instantiated, ASP.NET creates and initializes core objects such as HttpContext, HttpRequest, and HttpResponse</p>
<p>The HttpContext class contains objects that are specific to the current application request, such as the HttpRequest and HttpResponse objects. The HttpRequest object contains information about the current request, including cookies and browser information. The HttpResponse object contains the response that is sent to the client, including all rendered output and cookies.</p>
<p>After all core application objects have been initialized, the application is started by creating an instance of the HttpApplication class.  </p>
<p>An instance of HttpApplication processes only one request at a time.</p>
<p>The first time an ASP.NET page or process is requested in an application, a new instance of HttpApplication is created. However, to maximize performance, HttpApplication instances might be reused for multiple requests. When an instance of HttpApplication is created, any configured modules are also created (SessionStateModule, FormsAuthenticationModule). After all configured modules are created, the HttpApplication class&#8217;s Init method is called.</p>
<p><strong>Application Life Cycle in General</strong><br />
User requests an application resource from the Web server.<br />
ASP.NET receives the first request for the application.<br />
ASP.NET core objects are created for each request.<br />
An HttpApplication object is assigned to the request<br />
The request is processed by the HttpApplication pipeline.</p>
<p><strong>Global.asax</strong><br />
To handle application events or methods, you can create a file named Global.asax in the root directory of your application. If you add modules to your application, the modules themselves can raise events. The application can subscribe to in these events in the Global.asax file by using the convention modulename_eventname</p>
<p>ASP.NET pages are compiled, not interpreted. Instead of reading and interpreting<br />
your code every time a dynamic page is requested, ASP.NET compiles<br />
dynamic pages into efficient binary files that the server can execute very<br />
quickly. This represents a big jump in performance when compared with the ASP (interpreted predecessor)</p>
<p><strong>From DLL&#8217;s point of view</strong><br />
1. Client browser requests for an ASP.Net page to WebServer ( a computer where IIS and .NET framework installed)<br />
2. When IIS(inetinfo.exe) receives an HTTP request, it uses the filename extension of the requested resource to determine which ISAPI(Internet server application programming interface) program to run to process this request.<br />
When the request is for an .aspx page it passes the request to the ISAPI DLL (aspnet_isapi.dll) capable of handling request for ASP.NET pages.<br />
3.The aspnet_isapi.dll passes the request to ASP.Net Worker process(aspnet_wp.exe) to process the request<br />
4.The aspnet_wp.exe compiles the .aspx file into an assembly. creates an application domain and instructs the CLR to execute the resulting assembly in the newly created application domain.<br />
5.When the assembly for an ASP.Net page executes it uses services provided by various classes in the Framework to accomplish the given task and generates a response message for the requesting client<br />
6.The aspnet_wp.exe collects the response generated by the execution of the webpage, creates a response packet and passes it to the aspnet_isapi.dll process<br />
7.aspnet_isapi.dll forwards the response packet to IIS which in turn passes the response to the requestin client machine.</p>
<p>NOTE: Each ASP.NET page is converted to a class file (derived from System,Web.UI.Page) and is compiled into a DLL file. This class is compilee into a DLL file when the .aspx page is opened in the browser for the first time. All the HTML &amp; C# code in the .aspx page becomes part of the class file. The HTML elements are stored in  strings and do not interfere with the compilation process. The compiled dll files are managed by ASP.NET using a special directory structure within the &#8220;TemporaryASP.NET Files&#8221; directory under c:\winnt\microsoft.net\framework\v1.0.3705\TemporaryASP.net Files<br />
ASP.NET maintains a reference between the source .aspx page and the dll file.<br />
<strong>IMPORTANT: </strong><br />
Take care not to define class level code such as variable declaration, methods etc between the  render blocks in an .aspx page.<br />
Always write such things inside   block.<br />
 -&gt;as a code declaration block, marks the start of serverside<br />
code. ASP.NET know that this tag should be processed before sending the page to the browser.<br />
ASP.NET Provides a mechanism to separate the user interface portion of a webpage from the business logic.<br />
Have all UI related code in .aspx file and the business logic in .cs file and then link these two files using the page directive in the ASPX page.</p>
<p><strong>General Page Life-cycle Stages (SILVER U)</strong><br />
Page life cycle begins after the “Page request” is begins<br />
<strong>Start</strong> -&gt; Request and Response are set. Sets the IsPostBack &amp; UICulture property value.<br />
<strong>Page Initialization</strong> -&gt; Controls are available(but control values are not reloaded from viewstate).Any themes are also applied to the page<br />
<strong>Load </strong> -&gt; Control properties are loaded with information recovered from<br />
view state and control state.<br />
<strong>Validation</strong>	-&gt; sets the IsValid property of individual validator controls and of the page.<br />
<strong>Postback Event handling </strong>-&gt; any event handlers are called.<br />
<strong>Rendering</strong>	-&gt; Before rendering, view state is saved for the page and all controls.During the rendering phase, the page calls the Render method for each control,<br />
providing a text writer that writes its output to the OutputStream of the page&#8217;s Response property.<br />
<strong>Unload  </strong>-&gt; Unload is called after the page has been fully rendered, sent to the client, and is ready to be discarded.  At this point, page properties such as Response and Request are unloaded and any cleanup is performed.</p>
<p><strong>Life-cycle Events</strong><br />
Within each stage of the life cycle of a page, the page raises events that you can handle to run your own code.<br />
<strong>PreInit  </strong>-&gt; Check the IsPostBack property to determine whether this is the first time the page is being processed. Create dynamic controls, set master /theme / profile property dynamically.<br />
<strong>Init</strong>-&gt; Used to read or initialize control properties.<br />
<strong>InitComplete</strong> -&gt; Use this event for processing tasks that require all initialization be complete.<br />
<strong>PreLoad</strong> -&gt; Use this event if you need to perform processing on your page or control before the Load event.  You can add logic to do localization and view security here.<br />
<strong>Load</strong> -&gt; Calls OnLoad event method on the Page, then recursively for each child control. Use the OnLoad event method to set properties in controls and establish database connections<br />
<strong>Control events</strong> -&gt; Use these events to handle specific control events, such as a Button control&#8217;s Click event etc.<br />
<strong>LoadComplete</strong> -&gt; Use this event for tasks that require that all other controls on the page be loaded<br />
<strong>PreRender</strong> -&gt; The PreRender event occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls.<br />
<strong>SaveStateComplete</strong> -&gt; Before this event occurs, ViewState has been saved for the page and for all controls. Any changes to the page or controls at this point will be ignored.<br />
<strong>Render</strong> -&gt; the Page object calls this method on each control. (This is not an event). A user control (an .ascx file) automatically incorporates rendering, so you do not need to explicitly render the control in code.<br />
<strong>Unload</strong>  -&gt; This event occurs for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections.<br />
For the page itself, use this event to do final cleanup work, such as closing open files and database connections, or finishing up logging or other request-specific tasks.</p>
<p><strong>Compilation Life Cycle</strong><br />
ASP.NET compiles application items in a specific order</p>
<p>App_GlobalResources<br />
App_WebResources<br />
Web.config file<br />
App_Code<br />
Global.asax<br />
App_LocalResources<br />
Individual Web pages (.aspx files), user controls (.ascx files), HTTP handlers (.ashx files),<br />
    and HTTP modules (.asmx files)<br />
Themes, master pages, other source files</p>
<p>Compiled assemblies are cached on the server and reused on subsequent requests</p>
<p><strong>Login Control Events</strong><br />
The Login control can use settings in the Web.config file to manage membership authentication automatically<br />
LoggingIn , Authenticate, LoggedIn, LoginError</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=50&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2010/02/17/50/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>

		<media:content url="http://baskaronline.files.wordpress.com/2010/02/asp-fund.jpg" medium="image">
			<media:title type="html">aspImage1</media:title>
		</media:content>

		<media:content url="http://baskaronline.files.wordpress.com/2010/02/asp-fund2.jpg" medium="image">
			<media:title type="html">aspfund2</media:title>
		</media:content>
	</item>
		<item>
		<title>All about differences &#8230;</title>
		<link>http://baskaronline.wordpress.com/2010/02/12/all-about-differences/</link>
		<comments>http://baskaronline.wordpress.com/2010/02/12/all-about-differences/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 17:12:05 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=46</guid>
		<description><![CDATA[Whats the difference between Inproc and State server mechanism when storing an ASP.NET session? Ans. InProcServer -the session state is stored in the memory space of the Aspnet_wp.exe process. The session information is lost when IIS reboots. StateServer -the Session state is serialized and stored in a separate process call Viewstate &#8211; a .NET object [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=46&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Whats the difference between Inproc and State server mechanism when storing an ASP.NET session?<br />
Ans. <strong>InProcServer </strong>-the session state is stored in the memory space of the Aspnet_wp.exe process. The session information is lost when IIS reboots.<br />
     <strong>StateServer </strong>-the Session state is serialized and stored in a separate process call Viewstate &#8211; a .NET object that automatically persists data across the multiple requests for the same page. ASP.Net internally creates a hidden field with an ID=”__VIEWSTATE” and the value of the page’s viewstate is encoded (hashed) for security.</p>
<p><strong>Whats the difference between Page_Load and Page_Init events?</strong><br />
Ans. The Page_load event assures that all controls are completely loaded and Viewstate is complete.<br />
     Even though the controls are also accessible in Page_Init event but here the viewstate is incomplete.</p>
<p><strong>Whats the difference between Web.config and Machine.Config in .NET?</strong><br />
Ans. Web.config file is used to make the settings to a web application, whereas<br />
     Machine.config file is used to make settings to all ASP.NET applications on a server machine.</p>
<p><strong>Whats the difference between web.config and app.config?</strong><br />
Ans. Web.config is used for web based asp.net applications whereas<br />
     app.config is used for windows based applications.</p>
<p><strong>Whats the difference between a session object and an application object?</strong><br />
Ans. A session object can persist information between HTTP requests for a particular user, whereas<br />
     an application object can be used globally for all the users.</p>
<p><strong>Whats the difference between DOM parser &amp; SAX parser? when to use what?</strong><br />
Ans. The DOM Approach is useful for small documents in which the program needs to process a large portion of the document whereas<br />
     The SAX approach is useful for large documents in which the program only needs to process a small portion of the document.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=46&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2010/02/12/all-about-differences/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
		<item>
		<title>RESPONSE.Redirect Vs SERVER.Tranfer</title>
		<link>http://baskaronline.wordpress.com/2010/02/12/response-redirect-vs-server-tranfer/</link>
		<comments>http://baskaronline.wordpress.com/2010/02/12/response-redirect-vs-server-tranfer/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 17:00:08 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=44</guid>
		<description><![CDATA[Both RESPONSE &#38; SERVER are objects of ASP.NET. They both are used to transfer a user from one page to another. REQUEST is the message that the browser sends to the server and RESPONSE is the message the server sends back to the browser. Assume you have PAGE1.ASPX -&#62; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; RESPONSE.Redirect(&#8220;PAGE2.ASPX&#8221;); SERVER.Tranfer(&#8220;PAGE2.ASPX&#8221;); means, RESPONSE.Redirect -&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=44&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Both RESPONSE &amp; SERVER are objects of ASP.NET.<br />
They both are used to transfer a user from one page to another.</p>
<p>REQUEST is the message that the browser sends to the server and<br />
RESPONSE is the message the server sends back to the browser.</p>
<p>Assume you have PAGE1.ASPX -&gt;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
 RESPONSE.Redirect(&#8220;PAGE2.ASPX&#8221;);<br />
 SERVER.Tranfer(&#8220;PAGE2.ASPX&#8221;);</p>
<p>means,<br />
<strong>RESPONSE.Redirect</strong> -&gt; When Server receives this statement from browser,<br />
                               It immediately sends a command back to the browser<br />
                               to request PAGE2.ASPX from the server.</p>
<p>                               This extra round-trip is often inefficent and unnecessary.<br />
 		      NOTE: Roundtrip is the combination of a request being sent to<br />
                                to the server and response being sent back to browser.</p>
<p>                                URL in the address bar in the browser will show PAGE2.ASPX</p>
<p>                                By the time PAGE2 is requested, PAGE1 has been flushed from the<br />
                                server&#8217;s memory.<br />
                                Therefore PAGE2 cannot accesses PAGE1 data<br />
                                To achive this developer has to explicity save the information<br />
                                using some technique like<br />
                                Session/Cookies/Cache/Application etc at server end.</p>
<p><strong> SERVER.Transfer</strong> -&gt; When server receives this statement from browser,<br />
                             It just sends PAGE2.ASPX to the browser.<br />
                             No extra round trip occurs.</p>
<p>		   Here the PAGE1 data will be available in the scope of PAGE2.<br />
                    (OR)  PAGE1 data is forwarded to PAGE2. PAGE2 accesses PAGE1 data.</p>
<p>                            URL in the address bar in the browser will not change and<br />
                            still show PAGE1.ASPX</p>
<p>                            The PROBLEM here is &#8211; say the user reloads the page, the browser<br />
                            will request PAGE1.ASPX instead of the true page (PAGE2.ASPX)<br />
                            that he was viewing. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=44&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2010/02/12/response-redirect-vs-server-tranfer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
		<item>
		<title>Database Joins</title>
		<link>http://baskaronline.wordpress.com/2010/01/28/database-joins/</link>
		<comments>http://baskaronline.wordpress.com/2010/01/28/database-joins/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 21:29:57 +0000</pubDate>
		<dc:creator>baskaronline</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://baskaronline.wordpress.com/?p=38</guid>
		<description><![CDATA[INNER Join &#8211; * returns ONLY matching rows from both tables Ex. query compares each row of A with each row of B, if matched then each matched pair of rows of A and B are combined into a result row OUTER Join &#8211; returns BOTH matching and non-matching rows from both tables LEFT Outer [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=38&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>INNER Join  &#8211; * returns ONLY matching rows from both tables<br />
                  Ex. query compares each row of A with each row of B, if matched then each matched pair of rows of A and B are combined into a result row</p>
<p>OUTER Join &#8211; returns BOTH matching and non-matching rows from both tables</p>
<p>LEFT Outer Join &#8211; returns all the rows from the table on the LEFT side of JOIN keyword<br />
                          + returns the matching rows from both tables<br />
                        Ex.query always contains all records of the &#8220;left&#8221; table (A), even if the join-condition does not find any matching record in the &#8220;right&#8221; table (B).</p>
<p>RIGHT Outer Join -returns all the rows from the table on the RIGHT side of JOIN keyword<br />
                          + returns the matching rows from both tables</p>
<p>FULL Outer Join &#8211; returns all the rows from both tables.</p>
<p>SELF Join &#8211; A table joining to itself.</p>
<p>CROSS Join &#8211; used to return the cartesian product of the tables included in the join condition. If A and B are two sets, then the result of cross join is written as A × B.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
EXAMPLE:<br />
INNER JOIN<br />
SELECT * FROM   employee INNER JOIN department ON<br />
             employee.DepartmentID = department.DepartmentID<br />
is similar to<br />
SELECT *  FROM   employee, department WHERE<br />
employee.DepartmentID = department.DepartmentID<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
LEFT OUTER JOIN<br />
SELECT *  FROM   employee  LEFT OUTER JOIN department  ON<br />
 employee.DepartmentID = department.DepartmentID<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
RIGHT OUTER JOIN<br />
SELECT * FROM   employee RIGHT OUTER JOIN department ON<br />
employee.DepartmentID = department.DepartmentID<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
FULL OUTER JOIN<br />
SELECT *  FROM   employee FULL OUTER JOIN department ON<br />
 employee.DepartmentID = department.DepartmentID<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
CROSS JOIN<br />
SELECT * FROM   employee CROSS JOIN department<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
SELF JOIN<br />
SELECT F.EmployeeID, F.LastName, S.EmployeeID, S.LastName, F.Country<br />
FROM Employee F, Employee S<br />
WHERE F.Country = S.Country<br />
AND F.EmployeeID &lt; S.EmployeeID<br />
ORDER BY F.EmployeeID, S.EmployeeID;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/baskaronline.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/baskaronline.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/baskaronline.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/baskaronline.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/baskaronline.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/baskaronline.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/baskaronline.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/baskaronline.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=baskaronline.wordpress.com&amp;blog=9802275&amp;post=38&amp;subd=baskaronline&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://baskaronline.wordpress.com/2010/01/28/database-joins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ea8af3e96c3b632a27dd45d30387e989?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">BOSS</media:title>
		</media:content>
	</item>
	</channel>
</rss>
