Thursday, April 26, 2012

Page Life Cycle Satges

When an user requests for a page from browser then ASP.Net serves the page to the client/user during this service page passes via some stages this cycle of page processing is called Asp.Net Page Life Cycle.
All stages of page life cycle performed for partial page processing request also.(Like to process update panel.)

1. Page request - Page request raised before page life cycle started. Here Asp.net determines that a cached page can be served or need to compile and parse the page. If cached page not served then page life cycle is started.

2. Start - At this stage Request and response properties of page are set. Page determines that is it a postback then Ispostback property of page is set, also set UIculture property of page at this stage.

3. Initialization - At this stage controls of page are available, Unique Id property is set here for all controls of page. Master page and themes also applied to the page if applicable.

4. Load - At this stage properties of controls are initialize by values picked from View State and Control state, if page is postback.

5. Postback event handling - If page is postback then event handlers of controls are called. After that Validate method of all validation controls are called and IsValid property of validation controls and page is set.(An exception to this sequence is) Event handler that caused validation called after validation.

6. Render - At this stage View state is saved. Page calls Render method of all controls, with providing TextWriter so that out put is written to OutputStream object of Response property of page.

7. Unload - This stage occurred when page is fully rendered and sent to client. Response and request properties and other properties of page are unloaded and dispose is performed for all.

Thursday, April 19, 2012

Silverlight For Beginners

What is Silverlight?

Silverlight applications are based on XAML, so first learn something about XAML.
 
1. XAML(eXtensible Application Markup Language) is a declarative language to create UI, such as controls, shapes, text and other contents presented on the screen.
Its like HTML but more powerful, uses elements and attributes.

2. XAML is just a procedural code but easier.
<Button Width="60" Height="30">Click Me</Button>
In code behind we can do this like 
Button myButton = new Button();
myButton.Width = 60;
myButton.Height = 30;
myButton.Content = "Click Me";
LayoutRoot.Children.Add(myButton);

3. Attributes and Elements - Fill is an attribute assigned a color and Rectangle is an element.
<Rectangle Fill="Red">
OR
<Rectangle>
  <Rectangle.Fill>
    <SolidColorBrush Color="Red" />
  </Rectangle.Fill>  
</Rectangle>

Wednesday, April 4, 2012

Model-View-Controller (MVC)

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes.
MVC is not just a design pattern while its an architecture because its responsible for whole application not a part of application.

How is it beneficial?
1. User interface may change frequently, and if user interface and business logic combined in single object then every time you need to modify an object that contains business logic, this can introduce errors and require retesting of all business logic every time user interface changes.
2. In some cases application displays same data in different ways at same time, like a analyst may like spreadsheet view while management prefer charts(bar/pie/column) view, and If user updates one view then application must update all other views automatically.
3. UI design requires different skill set than developing business logic, rarely a person have both skill set, so its required to separate these to parts.
4. UI code is more device dependent than business logic. If you need to make a application mobile enabled then it require much UI design changes while business logic has no effects, a clean separation of these two parts accelerates the migration and minimize the risk of introducing errors in business logic.
5. Creating automated testing interfaces for UI is more difficult than business logic. So reducing the code that is tied with UI enhances the testability of UI (and application).  

CI/CD - Safe DB Changes/Migrations

Safe DB Migrations means updating your database schema without breaking the running application and without downtime . In real systems (A...