Visual Studio Team System 2010- Architecture Layer Diagram

Visual Studio Team System 2010 introduces a new diagram called "Architecture Layer Diagram". The introduction of the Architecture Layer Diagram means that a developer or architect can use models to enforce constraints on code as well. The Architecture Layer Diagram can be coupled to code making it an active diagram that can be used for validation. For example, when an architect designs a system where the presentation layer should not talk to the data layer, you want to be able to enforce that model at check-in. Visual Studio Team System 2010 can do that!!!!
 
Here is a screenshot of the diagram:
 
 
One word to express my feeling "Impressive". This’ll save me a lot of my time architecting my application and explaining to people the proper way to architect your applications into layers.
Advertisements

Adopting an Application Lifecycle Management strategy with Visual Studio Team System

Today I went to Microsoft’s Malaysia website and came across something interesting. Microsoft is organizing an event "Adopting an Application Lifecycle Management strategy with Visual Studio Team System". I would highly recommend those who are interested in application lifecycle management to attend this event. I’m particularly interested in:
 
. Practice Based Software Development with Team Foundation Server
 
. The Role of Architect in Building Better Enterprise IT Solutions
 

Data Controls – Examples

Today I delivered a training to a few freelancers (claimed to have several years of experience in .NET 2.0). I was really surprised when they didn’t know what is a GridView, DataList and SiteMapDataSource. Worried! I need to point to them in Visual Studio only then they remembered what is a GridView? Gosh! I have spent several hours going through with them those data controls. Finally, after I ended up with 21 examples covering GridView, DataList and SiteMapDataSource. I thought of sharing the codes over here so that I don’t have to recode and reexplain them to new freelancers. Hee! Hee!
 
 
Note: I’m using the Pubs database. I’m assuming that you have attached the database into a default instance of SQL Server Express Edition (I’m using the 2005 version).

MDeC Job Camp – Free Training

MSC Malaysia via its K-Workers Development Initiatives (KDI) is driving the provision of last mile skills training to potential knowledge workers (K-workers) for the ICT industry. Trainings are currently done through partnership with Multimedia Development Corporation (MDeC). MSC Malaysia Job Camp, a KDI programme, provides fresh graduates and available k-workers the necessary training to fill immediate vacancies in MSC, Malaysia Status companies. Job camp is designed specifically for any Knowledge worker who wants to improve or expand their current ICT skills and knowledge. This program seeks to help knowledge workers with the support and access to courses and trainings to stay aligned with the current needs of the ICT industry.

Recently, we worked with Nota Asia, a Microsoft Certified Partner for Learning Solutions (recently awarded Microsoft Gold Certified Partner) to offer the job camp. This job camp is completely free and only final year degree and higher degree students are eligible. If you are interested to know more about the program, please download the brochure at http://notaasia.com/MDeC/.Net%20Developer.pdf. If you are interested to apply, you may download the application form from http://notaasia.com/MDeC/Job%20Camp_Registration%20Form_v2%20_2_.pdf.

.NET Load Balancer – Log Shipping

I noticed that there are many companies in Malaysia using log
shipping. Configuring log shipping should be easy for any experienced
database administrators. However, having your applications to
automatically do the failover is rather difficult as you’ll need to
handle the failover programatically by the developers.

So what is log shipping? Log shipping allows you to automatically send
transaction log backups from a primary database on a primary server
instance to one or more secondary databases on separate secondary
server instances. The transaction log backups are applied to each of
the secondary databases individually. An optional third server
instance, known as the monitor server, records the history and status
of backup and restore operations and, optionally, raises alerts if
these operations fail to occur as scheduled.

Some of the problems (I’m referring to only those problems affecting applications) that I noticed on log shipping are:

1. Log shipping occasionally requires an affected database to go offline for log shipping restores.
2. A log shipping configuration does not automatically fail over from
the primary server to the secondary server. If the primary database
becomes unavailable, any of the secondary databases can be brought
online manually.

Based on (1) and (2) you must do one of two things to make your
applications work: either rename the standby server the same name as
the failed production server (and the IP address), or re-point your
applications to the new standby server during actual failover. In some
cases, neither of these options is practical. So I came up with the
idea of building a load balancer. For those who are interested to be
part of this project, please do send me an email at
ervinloh@hotmail.com.

The load balancer is to be developed in C# and runs as a Windows
service. The service is to check the affected database(s) for heath
statistics on a specified interval. I plan to expose the
functionalities of the service through employing technologies such as
WCF. I have yet to decide on the parameters that the load balancer
should check. One of the parameters that I foresee the load balancer
needs to check is ‘Least Privilege’ PerformanceCounter permissions. To
verify the functionalities of the load balancer, an ASP.NET Web
application is to be developed. I have the virtual images ready for
transaction log shipping. I think if the project is successful, we can
modify the load balancer to work on replicated databases.

To be able to participate in this project, you need the following knowledge:

1. C#
2. Visual Studio 2008 (I’ll be using Visual Studio 2008 Professional Edition)
3. LINQ
4. WCF
5. WF (to be used at a later stage to include workflow functionalities into the load balancer- first of its kind in the world.)
6. Windows Service
7. log4net
8. Subversion

Database Mirroring in SQL Server

Recently, I delivered a SQL Server training. I explored several high availability technologies in SQL Server such as database mirroring and transaction log shipping. After exploring several technologies, I began to like database mirroring. Reason is that I’m able to quickly implement applications since I could specify database mirroring details on the connection string itself. To me, this saves a lot of my time to implement my own custom load balancer (which I have plans to implement one using C#).

Database mirroring is a technology available for increasing database availability. Database mirroring transfers transaction log records directly from one server to another and can quickly fail over to the standby server. You can code client applications to automatically redirect their connection information, and in the event of a failover, automatically connect to the standby server and database. Fast failover with minimal data loss has traditionally involved higher hardware cost and greater software complexity. Database mirroring, however, can fail over quickly with no loss of committed data, does not require proprietary hardware, and is easy to set up and manage.

The following are the software that I have installed on my virtual image for testing:
. SQL Server 2005 Developer Edition Service Pack 1 (Note: You need at least Service Pack 1)
. Windows Server 2003 Enterprise Edition Service Pack 1

I installed 3 instances of SQL Server (instance 1 = default instance, instance 2 = SQLINSTANCE2, instance 3 = SQLINSTANCE3). SQLINSTANCE2 and SQLINSTANCE3 are the instance names for the second and third instance. For testing, I used the AdventureWorks database. The default instance will be the principal, the second instance will be the mirror and the third instance will be the witness. The following is the screenshot of all the instances:

Okay. These are the steps required to implement database mirroring:

Step 1: Do this on the principal instance
–Create endpoint on principal instance and set recovery model
CREATE ENDPOINT endpoint_mirroring
    STATE = STARTED
    AS TCP ( LISTENER_PORT = 5022 )
    FOR DATABASE_MIRRORING (ROLE=PARTNER);
GO
ALTER DATABASE AdventureWorks
SET RECOVERY FULL;

After step 1, you should see the following:

Step 2: Do this on the mirror instance
–Create endpoint on mirror instance
CREATE ENDPOINT endpoint_mirroring
    STATE = STARTED
    AS TCP ( LISTENER_PORT = 5023 )
    FOR DATABASE_MIRRORING (ROLE=PARTNER);
GO

After step 2, you should see the following:

Step 3: Do this on the witness instance
–Create endpoint on witness instance
CREATE ENDPOINT endpoint_mirroring
    STATE = STARTED
    AS TCP ( LISTENER_PORT = 5024 )
    FOR DATABASE_MIRRORING (ROLE=WITNESS);
GO

After step 3, you should see the following:

Step 4: Do this on the principal instance. I’m assuming that you have created a directory called MirrorBackup prior to this step.
–Backup principal database
BACKUP DATABASE AdventureWorks
TO DISK=’C:\MirrorBackup\AWBackup.BAK’
with init;
GO

Step 5: Do this on the mirror instance
–Restore mirror database
RESTORE DATABASE AdventureWorks
FROM DISK=’C:\MirrorBackup\AWBackup.BAK’
WITH NORECOVERY,
MOVE ‘AdventureWorks_Data’ TO ‘C:\Program Files\Microsoft SQL Server\MSSQL.4\MSSQL\DATA\AdventureWorks_Data.mdf’,
MOVE ‘AdventureWorks_Log’ TO ‘C:\Program Files\Microsoft SQL Server\MSSQL.4\MSSQL\DATA\AdventureWorks_Log.ldf’;
GO

–On the mirror server set the principal server
ALTER DATABASE AdventureWorks
    SET PARTNER =
    ‘TCP://MIAMI:5022’
GO

After step 5, you should see the following:

Step 6: Do this on the principal instance
–On the principal server set the mirror server
ALTER DATABASE AdventureWorks
    SET PARTNER = ‘TCP://MIAMI:5023’
GO

–On the principal server, set the witness
ALTER DATABASE AdventureWorks
    SET WITNESS =
    ‘TCP://MIAMI:5024’
GO

After step 6, you should see the following:

Step 7: Do this on the principal instance to switch roles from principal instance to mirror instance.
— Perform manual failover
ALTER DATABASE AdventureWorks
    SET PARTNER FAILOVER
GO

After step 7, you should see the following:

That’s all. 🙂

ASP.NET MVC Framework on Visual Web Developer 2008 Express Edition

Some time ago I did an evaluation of the ASP.NET MVC Framework (the very first preview of the framework). I was introduced to this framework by a friend of mine (Patrick Yong). The ASP.NET MVC enables you to build Model View Controller (MVC) applications by using the ASP.NET framework. ASP.NET MVC is an alternative, not a replacement, for ASP.NET Web Forms that offers the following benefits:

* Clear separation of concerns
* Testability – support for Test-Driven Development
* Fine-grained control over HTML and JavaScript
* Intuitive URLs

If you want to learn more about the framework, you may go to http://www.asp.net/mvc/. Do remember to download the videos and the starter kit. The project url is located at http://www.codeplex.com/aspnet.

Okay. Back to the actual point. At the time when I was evaluating the framework, out of curiosity I began to explore all the Visual Studio directories on my virtual images (I have installed Visual Web Developer 2008 Express Edition and Visual Studio 2008 Professional Edition on different virtual images.). Then I found something known as templates. Visual Studio allows developers to create their very own versions of templates. So I began to modify the ASP.NET MVC Framework templates (VB .NET and C#) on the virtual image of Visual Studio 2008 Professional Edition. After modifying I dump my modified templates (from Visual Studio 2008 Professional Edition virtual image to Visual Web Developer 2008 Express Edition) into the

….\My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual Web Developer

directory. Then I startup my Visual Web Developer 2008 Express Edition. To my surprise, the template really appears under "My Templates" group of the "New Web Site" dialog. 🙂

"Err.. Arghh.. Anyone can tell me whether I could upload a zip file to my blog (don’t tell me to use SkyDrive)? I wanted to upload my templates ler. Hai.. No choice. Need to use SkyDrive."

Here you go:
VB.NET Template Url: http://cid-d1df34a904545dc5.skydrive.live.com/self.aspx/Public/ASP.NET%20MVC%20Web%20Site%20|5VB.NET|6.zip
C# Template Url: http://cid-d1df34a904545dc5.skydrive.live.com/self.aspx/Public/ASP.NET%20MVC%20Web%20Site%20|5C|3|6.zip