Thursday, July 8, 2010

My new Blog site

I have started a actual personal blog that I will be using from now on. I will probably port most of the old items to that blog. If you are interested the site is

http://www.mohammadhoque.com


I will depricate this blog slowly.

Thanks.

Monday, June 14, 2010

MVC 2 Hosting

I just found out recently that my current hoster webhost4life doesn't support the MVC 2. Had to jump through few hoops to figure that out. Their customer service is not anywhere reasonable. So I am shopping for new hosting provider again.

Found few that I want to look closer.

Discountasp.net was great till I needed more SQL server database. It costs lot more if you are using more than one SQL server database for your application. So Discountasp.net is out of the equation too.

Finally I have signed up with SoftSys Hosting. I like the services they are offering. Unlimited Domain, 5 SQL Server Database, 5 MySql Database and more. Like their hosting panels also and you can have dedicated app pool. Sweet.

Wednesday, June 9, 2010

Code Generation with T4 template

Many of you have been using CodeSmith for code generation and loving it. I know when I use my codesmith, I create my template as I like it to be and then I just let it generate my codes. I just love the fact that I can click a button and I have a framework. One dark side if the CodeSmith is that, it is not free. But the cost is nothing compared to what you are getting in return.

You can always do the same thing with "FREE" Microsft T4 templates.

T4 template comes with Visual Studio 2008 and you can also download it for 2005. Visual Studio 2010 has T4 template integrated with it. So there is no reason for not liking it. Once you get the T4 setup correctly, you will love it.

I am going to give you few links that you can use to learn this tool

1. http://www.olegsych.com/2007/12/text-template-transformation-toolkit/
2. href="http://www.hanselman.com/blog/TheBestVisualStudio2010ProductivityPowerToolsPowerCommandsAndExtensions.aspx
3. http://blogs.msdn.com/b/webdevtools/archive/2009/01/29/t4-templates-a-quick-start-guide-for-asp-net-mvc-developers.aspx

Feel free to share your thoughts and anything cool you have done with T4.

Hopefully this helps.

Thursday, March 18, 2010

DatePicker only TextBox

There are few times when I was thinking that using my textbox with Calendar control will only allow users to input values selected from that DatePicker calendar. If you are assuming this...read on.

One of the trick that automated test and testers use to test your user interface is .... guess....

If you were thinking "Copy-Paste" you are right.

To make the DatePicker to have only the values picked from your calendar, you have to be little tricky. This is what you should do..

In the textbox where you have your calendar control associated, make the textbox readonly="readonly". Now user can't input anything manually but JQuery will still be able to update the value with selected DatePicker value.

Simple. Isn't it.

Monday, February 22, 2010

Many to Many Attribute mappings for nHIbernate class


How to use Attibute mapping with a ManyToMany Relationship with nHibernate

I have been using nHibernate and MVC to create application for my current client. For different reasons, the development team decided to go with attribute level mapping with entites vs fluent nhibernate or hbm mapping.

This document will show you how you can achieve that for a ManyToMany and ManyToOne and OneToMany Relationship. I have used sqlExpress. You can use any database you like. The downloadable project will have scripts to create the database for you.


DataModel:

Entity1 : First Entity
Entity2 : Second Entity.
XREF : Mapping Table with Entity1 And Entity2 with NO ADDITIONAL fields.
XREFPlus : Mapping table between Entity1 and Entity2 WITH ADDITIONAL fields.


Things to Know About Mapping.
XREF is a purely mapping table to facilitate a many to many relationship. If you find yourself in this situation, you do not need to create any entity class for that table. Your relational mapping with create the script on the fly to enter on that table.

But. XREFPlus is different. Since it has more fields than just the Foreign Keys. It is an One-to Many relation for both the entities. You will have to create a class for this and map this as One-To_Many and Many- to-One.
I have used Codesmith to create my basic project. Code smith doesn’t support attribute mapping yet. So This is how I created my own. Hopefully, If you are in the same show as I was, It will help you. I am trying to keep this short. Take a look at the included zip file and play around with it. Have fun.

UPDATE : Go to here for source Code.

Tuesday, January 26, 2010

Check Out the PLINQO and CodeSmith 5.2

Check out the CodeSmith 5.2 and PLINQO( http://plinqo.com) when you get a chance. I bet it will make your life easier and your program lot faster.

LINQ to SQL Profiler is a real-time visual profiler allowing you to gain valuable insight and perspective into an application's database interaction. It makes it easy to identify your applications hot spots. Not only does LINQ to SQL Profiler show you what is going on, but it will take it a step further in suggesting possible changes that will make your code more efficient. LINQ to SQL Profiler is a must on the tool belt of anyone using PLINQO.

I have been using CodeSmith and PLINQO for a while and love it. Give it a go and let me know what you think.