Geeks With Blogs

News Google

Nick Harrison Blog<Nick>.Next() July 2010 Entries
Error Serializing Data after Switching from an Entity to a DTO
I recently had to introduce a DTO pattern on a project. The application was split between a server side and a desktop side using http based WCF to handle the communication. The project had been working well passing NHibernate entities back and forth, but there was too much data being transferred. So we introduced the DTO pattern. I added a GetDto method to the base class for the Entities. I added a GetEntity to the base class for the DTOs. We created DTO objects for the entities that we wanted to ......

Posted On Friday, July 16, 2010 4:26 PM

Revisiting Agile Documentation
I have spoken in the past about the burden that keeping documentation up to date. This can be quiet a cumbersome burden. At the same time, we clearly need some documentation and are often required to provide more documentation than is absolutely needed. With all this in mind, I have been thinking about ways to design code to lessen the amount of documentation that has to be written and maintained. Turns out, there are many cases where such design changes improves the quality of code, lowers the maintenance ......

Posted On Friday, July 9, 2010 5:02 PM

Snazzy Syntax for Converting a List of Entities to a List of Dtos
Following a Data Transfer Pattern, you are often faced with having to convert a list of Entities to a list of Data Transfer Objects (DTO). A common strategy is to provide a GetDto() method in the base class for the Entities. This leads to a conversion process similar to: foreach (var entity in ListOfEntities) { ListOfDTOs.Add(entity.GetDt... } While this works it is a little clutzy and cumbersome, especially considering the alternative. This can be converted to a LINQ expression as var ListOfDTOs ......

Posted On Friday, July 9, 2010 3:16 PM

Inheriting a Class Map in Fluent NHibernate
It is common for every table to have a common set of audit tracking fields such as DateLastModified, UserIdLastModified, etc. In our entities, this is easily supported by having these properties defined in a base class that every entity derives from. This has always been somewhat cumbersome from a mapping perspective. Using classic hbm mapping files there is no way to inherit such details and they had to be repeated for each mapping. One of the many benefits that Fluent NHibernate brings to the table ......

Posted On Friday, July 9, 2010 2:14 PM

Let me tell you about my day
My day started out very rough. Hit a few rough patches early on, but then turned around to end as one of the best days of the year! I spent the night in the hospital last night. My wife had surgery yesterday and I stayed with her. No one wants to stay in the hospital, right? Bright and early at 6 AM, I went to the car and discovered a flat tire. I am a software guy. Changing a tire is too much like hardware. I have changed 3 flat tires career total. In the course of changing the tire, I learned a ......

Posted On Friday, July 2, 2010 8:56 PM

Single Line threading with Lambdas
I have been playing around with lambda syntax and some of its implications. I came across a rather clever way to launch a simple thread. (new System.Threading.Thread(() => { Function(param); } )).Start(); Of course if all you have is a single line, you can replace it with: (new System.Threading.Thread(() => Function(param))).Start(); This makes it real simple to call a method in a separate thread. This can be very useful and make it very easy to build more responsive logic. Sadly it also makes ......

Posted On Thursday, July 1, 2010 12:24 PM

Copyright © Nick Harrison | Powered by: