Wednesday, June 14, 2006

Microsoft .Net Framework 3.0

Vice President S. Somasegar describes the decision to rename WinFX to the .NET Framework 3.0. Now the WinFX technology you know has a name that identifies it for exactly what it is—the next version of the Microsoft developer framework

for more information please follow this link.

VSTS Database Professional

New Version of Visual Studio Team System is alive now...

Visual Studio Team Edition for Database Professionals.

You can find out more about it and get access to early community technology previews here.

Monday, June 12, 2006

Provider Pattern (Overview)

Provider Pattern

A provider is simply a contract between an API and the Business Logic/Data Abstraction Layer. A provider implementation must derive from an abstract base class, which is used to define a contract for a particular feature

Common Behaviors/Characteristics:
Below is a listing of characteristics common to providers.


1. Base class
A base class should have as few methods and properties as possible. This is desirable to encourage developers to write providers.

2. Threading
Providers should be free-threaded/thread safe, with one instance per application domain. Any provider-specific objects created more frequently (for example, one per request) should be created through provider APIs.

3. Factory methods
The abstract base class should support factory methods to create new objects wherever appropriate.

If a feature allows a provider to create a framework object, but does not allow the provider to extend the object, the framework class should be sealed.

Complex objects created by a provider may keep track of the provider that created it, and expose it as a Provider property. This allows users of the feature to determine the provider that owns the data for the object. For example, when a new user is created with the Membership API, it may be useful for the developer to be aware of the provider that data for the object is stored in.

4. Class naming and namespaces
The specific provider base classes should be named [Feature]ProviderBase.

5. Common naming patterns for provider classes
Figure 5 below calls out some of the common names and casing that should be used for various data stores (where name is [Name][Feature]Provider).





Refrence: Provider Model Design Pattern and Specification, Part 1

Sample Code HERE

Good Luck & happy programming.

Wednesday, June 07, 2006

Master-Slave Replication Pattern


Data Patterns (Master-Slave Replication Pattern)

As we know there is a punch of data patterns and today we are going to discuss one of them (Master-Slave Replication Pattern).

Why do I need Master-Slave Replication Pattern?
You may need Master-Slave replication pattern if you have to synchronize data from the source to the target without transmitting back the data to the source (One-way synchronizing). This means the data will be copied to the target without regard to any updates occurred on the target since the last replication.

The following figure shows the Master-Slave Replication.


Acquire
Reads the content of the Replication Set (Data) from the source to get the ONLY the updated data.

Manipulate
Manipulating & preparing the Replication Set (Data) to be copy to the target. Usually this manipulation includes data type converting, concatenating and splitting fields (e.g. Extracting first name from a full name).

Write
Writing the manipulated data (from the previous step) to the target. This operation either overwrites the data on the target, or compares the data with the manipulated data and copy the updated data only.


Reference:
Microsoft Data Patterns

Tuesday, May 30, 2006

Master Page & Find Control

this.FindControl("myControl");

I realy miss this sentence. Since I start using ASP.net 2.0 I’m not able to use it if try to get a control inside page that has master page, because I’ll get an error that says “Object reference not set to an instance of an object.” (did I see this error before? ;) , sure I did). This error occures because the control cannot be found!! Let me explain why:

When you apply a master page, that master page has a ContentPlaceHolder control, and your page has only an <asp:Content/> control. This Content control get stripped and discarded and never makes it to the final Page control structure. The contents of the Content control are merged into the ContentPlaceHolder. The result is that the page ends up with only 1 control in its Controls collection: a ContentPlaceHolder from the master page. (Thanks to Jeffrey Palermo for his article)

OK I get it. Now how can I reslove this issue???
The answer is by trying to search for your control inside the Form of the page. Check this out :


this.Form.FindControl("myControl");

Good Luck & Happy Programming.

Friday, October 21, 2005

C# Property Builder

After wasting a lot of time writing the properties for the business entities I decide to create a small application that saves my time for this issue.

You may download the setup file by clicking here

Source code also available on here

Good Luck