Showing posts with label NETDUG. Show all posts
Showing posts with label NETDUG. Show all posts

Thursday, December 6, 2007

Visual Studio 2008 Training Kit

Microsoft has released a training kit for Visual Studio 2008. You can get it at

http://blogs.msdn.com/daiken/archive/2007/11/19/visual-studio-2008-training-kit-now-available.aspx

Definitely worth picking up.

Cool Things in .NET 3.5

This does require Visual Studio to upgrade the database. I am using the Visual Studio Professional Trial for now.

So download the sqlce database from http://www.andargor.com/. Unpack the zip file to the C:\SQLMETAL directory. Now upgrade it according to Microsoft's Instructions at Upgrading CE from Earlier versions.

Next open a Visual Studio Command prompt and change to the directory where you have the compact database from above.

type in the following command

sqlmetal /code:srdce.cs /namespace:d20 /pluralize /serialization:unidirectional /language:csharp srdce.sdf

Open the file srdce.cs in Visual Studio. You now have a class library representation of the database and tables in the srdce.sdf database (in my case it is 6600+ lines of code) with full attributes for the database columns and tables with 10 classes (one per table) that describe the columns of each table and on class name srdce that has the collections classes for each of the table.

Now open a new C# class library (dll) project in Visual Studio named srdce and add C:\SQLMETAL\srdce.cs to it as a C# class.

Next add references to System.Data.Linq and System.Runtime.Serialization. Now compile once for a test to make sure you got everything right.

Next add a new test project to the solution named srdcetest. Add a project reference to the srdce project to the srdcetest project. Right click on the node for srdcetest and select add/Unit test. This will generate unit tests for all the classes generated from the database.

Next compile the solution to make sure everything works. Now go to the Test Menu and select "run all tests in solution". All the test should fail with a Assert.Inconclusive.

So now we do a little of the red/green/refactor thing. All of our tests fail, so we got red down. Now I want to have a test pass. So goto the SkillsTest method in the SrdceTest class. Change the code to

//IDbConnection connection = "d:\\sqlmetal\\srdce.sdf"; // TODO: Initialize to an appropriate value
Srdce target = new Srdce("c:\\sqlmetal\\srdce.sdf"); // TODO: Initialize to an appropriate value
Table<Skill> actual;
actual = target.Skills;
List<Skill> SkillList = new List<Skill>();
foreach (var Skill in actual)
SkillList.Add(Skill);
Assert.AreEqual(SkillList.Count, 40);

Now go to the using block at the top of the test class and add

using System.Collections.Generic;

Now go back to the SkillsTest method and right click and choose run tests. This should complete correctly.

So we have taken a database, created a class hierarchy for it, created some unit tests, refractored a unit test to be green and basically the result is as follows:

  1. We now have a done a ORM mapping between a database and a C# class hierarchy.
  2. We generated 304 Unit Tests.
  3. We proved that we can select all the data from the skills table and put it into a list for later use in the application. The list is a strongly typed list of the base data type.

Pretty cool, eh?

In later entries I will show how to create a database from the class hierarchy and how to persist data to the database. Finally we will look at how to make the class hierarchy a set of dll's that can be used as plugins in a application.

Friday, November 30, 2007

What's New in .NET 3.5 and VS 2008

In preparation for the Install Fest I am putting together some demos for the .NET users group on some of the new features in .NET 3.5 and Visual Studio 2008. I am sure Jason or Mithun will be providing some slides and presentation from Microsoft, I am just putting together some notes from my last 6 months of working with the betas and the final release. I will add notes as I find interesting things.

NETDUG Install Fest

I got an announcement a few weeks ago from the NETDUG support Mailing list. It is a chance to install the new Visual Studio 2008 product on one of your systems. Specifically Microsoft, the Boise .NET Developers User Group (NETDUG), and the Boise Software Developers Group (BSDG) are having a Visual Studio 2008 InstallFest and Holiday Party on December 6th, 2007 at the Overland Park Cinemas in Boise.

This event is your opportunity to get your hands on the released version before anyone else. Every person that installs Visual Studio 2008 on their computer at the event will receive a FREE fully licensed copy of Visual Studio 2008 Professional in the mail shortly after public release.

Registration link: http://msevents.microsoft.com/CUI/EventDetail.aspx?EventID=1032360765&Culture=en-US

Thursday, December 06, 2007 1:00 PM-5:00PM
Overland Park Cinemas
7051 Overland Road
Boise Idaho 83709

Show up if you can. Should be fun.

Sunday, September 23, 2007

NETDUG Meeting and Software Patterns

I attended the NETDUG Meeting on Thurs. Sept. 20th. It is always a good meeting. I went to this one specifically to pick up my presentation materials for the MSDN event on Oct. 4th. In addition they had a INETA speaker there and I wanted to hear what he had to say about MVP patterns and ASP.NET.

The talk was titled Separation of Code and UI with MVP, by Scott Cate. Scott is a very dynamic speaker and I enjoyed some of the talk but once he really got into the discussion of Model Viewer Presenter I got bored and left to talk to the Microsoft reps. My problem with MVP is I learned it as MVC in my smalltalk days. Now most material on MVC/P is old hat. I agree with Scott however, you have to keep talking about it. Some developers never learned it.

I find myself going back to the tools more and more. Good tools support good practices and promote use of patterns. Poor tools do not. Fowler has always had some good discussion of patterns and some good documentation but it is hard to visualize software patterns until you get a good clean code example. This goes against what most pattern authors are trying to achieve since it brings implementation issues into what is purely a architecture discussion.

I believe in some case it makes it clearer. I will post a few patterns and their implementations that I have found helpful over the next few months.