Tuesday, June 23, 2009

Partial review of Pro ASP.NET MVC Framework

I've just finished the last chapter of part 1 of Pro ASP.NET MVC Framework. In this part, the author teaches me how to write a small online store where users can browse all products, filters the products by category, add products to cart, remove them from cart, and do check out. The store also has a basic administration area where the administrator can add/update/remove products (with theirs pictures).

What I learn from this part are

  • Understand the steps to create a real ASP.NET MVC application
  • How to write unit tests for routing/controllers with NUnit and Moq
  • There is a surprise that the author used Castle Windsor as IOC container for this application which I want to know the basic

I will continue with part 2, and for sure, I will come back with the review of part 2.

BTW, if you want to learn ASP.NET MVC in practical, you must read this book.

Monday, June 01, 2009

How to create a SQL Server database by command line

In previous post, I show you how to attach a SQL Server database by command line, and here I want to show you how to create a SQL Server database by command line.

C:\>sqlcmd -S .\SQLEXPRESS -E
1> use master
2> go
Changed database context to 'master'.
1> create database teamcity collate Latin1_General_CI_AI_KS
2> go

Sunday, May 31, 2009

How to attach and detach SQL Server database by command line

SQL Server comes with an useful command line tool (sqlcmd.exe) to help manage your database. And here is how to attach a database to SQL Server:

C:\>sqlcmd -U your_username -P your_password
1> use msdb
2> go
Changed database context to 'msdb'.
1> sp_attach_db 'database_name', 'data_file', 'log_file'
2> go

Update: And here is how to detach a database by command line

C:\>sqlcmd -U your_username -P your_password
1> use msdb
2> go
Changed database context to 'msdb'.
1> sp_detach_db 'database_name'
2> go

Tuesday, May 26, 2009

Should I ignore NUnit 2.5?

I use built-in test runner in ReSharper to run NUnit tests. But this code fragment is passed with NUnit 2.5, but not with NUnit 2.4.8. Try to find, sadly, it is problem of licensing.

[Test]
[ExpectedException(typeof(ArgumentException))]
public void DivideANumberByZeroShouldThrowException()
{
// do nothing
}

I can use NUnit test runner, but I prefer to use ReSharper built-in test runner, which provides visualization to see the result. Should I ignore NUnit 2.5?

Update: After a while, I have the answer is "No". But to use ReSharper to run tests with expected exceptions, I need to change the way how to write test code. There are 2 ways to make the test runs well:

Assert.That(delegate { clz.Divide(3, 0); }, Throws.InstanceOf<ArgumentException>());

and

Assert.Throws<ArgumentException>(delegate { clz.Divide(3, 0); });

I prefer the first way.

Reference:

Friday, May 15, 2009

Visual Studio 2010 will support LESBIAN and TDD strongly

Just open this link, you will find out that Visual Studio 2010 will support LESBIAN and TDD strongly.

Thanks Google, you made me fun. And for sure I will get this beta with my MSDN account and try the new BigInteger :-D

Tuesday, May 05, 2009

Windsor 2.0 is released

Today, Ayende and his team released Windsor 2.0. Even I'm more familiar with ActiveRecord than Windsor, I will use Windsor for my future projects. And, for sure, I will take a look at the upcoming version of MonoRail when it'll out as a competitor of ASP.NET MVC.

Congratulation!

Why I like MVC

These days there are many discussions about ASP.NET WebForms vs ASP.NET MVC and why they prefer ASP.NET WebForms over ASP.NET MVC, or vice versa. But there is only one REAL reason I prefer MVC, in this particular case ASP.NET MVC (over ASP.NET WebForms), is I HAVE FULL CONTROL. When I like to have full control, it doesn't mean I don't trust others, and even I need to work more (to control), but I HAVE MORE FUN.

So I total agree with Jeffrey, "ASP.NET MVC in Action" author.

Friday, May 01, 2009

Code Progression

Just found a blog about automation building with TeamCity and enjoy reading it :-)