Martijn Veken


Just having
some fun with .NET

May 2006 - Posts

Resharper 2.0 is available now!

My favourite tool in Visual Studio 2003 has always been JetBrains' Resharper. A couple of months ago we converted our application to the .NET 2.0 framework and Visual Studio 2005. Although VS 2005 now has some of the refactoring and analysis features that Resharper offered, it is nowhere near as powerful. So I was really happy to see that JetBrains was developing Resharper 2.0 for VS 2005. That happiness rapidly disappeared after installing the beta. It was really buggy and therefore impossible to use.

The last time I installed a beta was just 2 or 3 weeks ago and it still was not good enough to use in my daily work. The biggest problem was the static code analysis that got really confused when the same classname was used in different namespaces. Meanwhile I tried other tools like Omnicore's JustCode, but they just aren't as good as Resharper.

Today I read on Scott Guthrie's Blog that the final verion had been released, so I decided to give a last try. And guess what... it works perfectly. Nomore stange analysis errors, no more empty code completion boxes... And the best thing is: 1.5 users get a free upgrade to 2.0!

So, I'm a happy coder again

MyGeneration experiences

I've been reading some of Patrick Wellink's posts about MyGeneration with dOOdads and I was curious if the productivity claims he was making are really true. Because the application that I'm currently working on already has a complete DAL in place, this was not a good candidate to try it on (I don't think I would have made it out of the office alive ;-). But one of my personal web sites was a perfect candidate to try it on.

Last year I promised some of my friends that I would build a web site for the Formula 1 competition we were having. Before every race we would e-mail our forecasts for the race and some pour fellow would calculate the results manually. I said that I could easliy build a web site for this, but I forgot to do so until 3 weeks before the start of the season. So, I "developed" the site under some time stress, created an Access database, dragged and dropped some dataconnectors on the forms and bound the controls to them. It worked and looked rather nice from the outside, but is was far from perfect.

First I used the Access upgrading wizard to migrate the tables and data to SQL Server 2005 Express and translated some of the queries that I had build to SQL views. For the dOOdads architecture to work, you will need to create some extra stored procedures in the database. I used the "SQL_StoredProcs.vbgen" template in MyGeneration, selected the tables I wanted the procedures generated for, and after a couple of seconds the script was ready and I ran it on the database.

After this I used MyGeneration with the "CSharp_SQL_dOOdads_BusinessEntity.vbgen" template to create the data access classes, which I added to my project. These classes are impletented as abstracts so you will have to write concrete classes to implement them. Or ofcourse, generate them with the "CSharp_SQL_dOOdads_ConcreteClass.vbgen" template (you will have to add an using directive to this template to the namespace that you have used to generated the data access objects).

The last generation step is to create objects for the views in the database using the "CSharp_SQL_dOOdads_View.vbgen" template. These are implemented in concrete classes already.

To make all of theses classes work, you will have to add the MyGeneration.dOOdads project to your solution. Don't forget to set the "Build Action" property to compile for SQLClientEntity and the SQLDynamicQuery classes. Build the solution and you're ready.

It took me about 30 minutes to do this, but if you've done this before, you can do it in 5. Converting the rest of the application was very easy. The dynamic query feature of the dOOdads lets you create strong typed dynamic queries with great ease and loads them into the business objects. The objects have a DefaultView property that you can use as a datasource for your controls.

Other nice features of the dOOdads architecture are:

  • String properties: these are string equivalents of the fields of your objects, that make the handling of null values easy by converting them from and to empty strings.
  • Prevention of SQL-injection attacks.
  • Easy transaction handling

For a good impression of all the dOOdads features read this introduction document.

MyGeneration and the dOOdads architecture make it really easy to create a useful solid DAL for your application. There are also a lot of other templates available for MyGeneration on their site. Creating your own templates will be a bit harder. The IDE has no intellisense and you will have to build your scripts in a sort of ASP.

Back on the blog

After a period of radio silence I have decided to sharpen the pencil (euh... keyboard) again. The last couple of months I lost a bit of the joy in development and didn't feel like blogging about it, but now I am "back on the blog".

So I cleaned up the site with a new theme for a fresh new start

But ther will be more soon! I am currently checking out new tools and techniques and I will share my findings with you. Some of the things I'm looking at are MyGeneration/ dOOdads and the new Atlas control set. I'm applying these on my personal website (a Formula 1 competition site), which will be accessible in a short while.