Ivan Mitev In The Software Trenches

Technology weblog on .NET development and other things that make the world go round

November 27, 2004

3 seminars in 6 days

I am probably devoting too much of my time goining to seminars. But, you know, I think it's worth it. And those 3 were pretty useful. Let's give a brief summary for each of them:

The first event was organized by Microsoft and held in Sofia Univeristy last Sunday. The speakers were good. I liked very much the lectures about Microsoft Solution Framework and SharePoint, since I didn't know much about them. There was also much talk about Service Oriented Architecture and Web Services. I think I got the point, but I don't want to get any deeper in these areas right now. There was a lecture about an interesting project, called FABRIQ, which purpose resembles some of the features of the Microsoft project Indigo, that is coming soon. A very intruguing solution for some enterprose projects.

The next seminar was again a Microsoft one, but more official. It was held on Tuesday at the Inter Expo Centre. Microsoft invited representatives of their ISV Bulgarian partners. There were just 4 lectures, mostly about enetreprise solutions. Again SOA, Web Services, connected systems, blah-blah. The thing I liked the best was to get acquainted with BizTalk, not widely known, but a very interesting product. One develops a BizTalk solution entirely in VS.NET 2003 IDE. There is an administrative panel to use when the project is deployed, so the sysadmins can monitor, stop, resume some processes and customize them a bit. I can talk now much about it, but better, go check it yourself.

The last event this week was held yesterday in the Sofia University. It was about "Writing quality maintainable code". This is a very important topic, so I went there after work. In fact, I did not learn many new things, but it is good to be reminded about the best practices, that one sometimes forgets about. The lecturers knew what they were talking about and did a pretty good job. Well, the presentations took double the time that they had estimated, but let's be forgiving ;) Good job, keep them comming...

November 22, 2004

OR Mappers for .NET

I am interested in the topic of OR Mappers for .NET, since I have written mine own for my first .NET project. It may be better qualified as a Data Access Layer, but it had some OR Mapping features. The framework was successfully used in a MS Access-connected application. Its initial design was not not perfect but I improved it a lot to make it useful for our next project. I added better support for transactions and made it work with Oracle DB, too. The change required some significant refactoring to support such things as Oracle sequences, but at the end it worked out really well.

Looking at this past experience, I think, I probably reinvented the wheel. There are plenty of OR Mappers out there and some of those are open-source projects. Nevertheless I feel happy with what I did, since I gained some invaluable real OO-design experience (and ADO.NET too). I have to confess that was my first significant architectural challenge and it came out pretty well. Well, as I said, the first versions were a bit crappy, but after each revision and refactoring, the design concepts became clearer and the solution cleaner and easily extensible.

An interesting aspect of my framework is that it relied on .NET attributes for class<->table and property<->column mapping (which was probably not the best way to handel this). I learned recently about Hibernate in Java and I liked the idea of XML mapping configuration better. This was the reason to do a further research on the topic OR Mappers for .NET. This research is greatly influenced by a presentation on ADO.NET and Data Persistence Frameworks by Sean McCormack. So let's list the frameworks, mentioned in his presentations and a few more:

Open Source
Sisyphus
NHibernate
Gentle.NET
Atoms
OJB.NET
Neo
ORM.NET
NPersist
RETINA.NET
Perseus.NET

Commercial
EntityBroker
DataObjects.NET
LLBLGen Pro
Tier Developer
Objectz.NET
Wilson ORMapper
eXpress Persistent Objects for .NET


Note: The order in which I listed those OR Mappers was really random. Since I have not tried none of them, I can't give opinions of their pros, cons etc. But I can guess that NHibernate will be sooner or later successful as its Java framework origanator Hibernate. I can also put my bets on Neo, which is developed by people from ThoughtWork (and the quality of the work of those people is always outstandting).

But how to choose a OR mapper from such a variety? What features to expect from it? Argh, tough questions! So I will just quote Sean McCormack opinion:

Desired features of a OR Mapper
  • Support for run-time and design-time object relational mapping

  • Built-in logging / tracing

  • Object caching

  • Object versioning (optimistic and pessimistic concurrency)

  • Support for multiple databases

  • Support for multiple persistence types (file, RDBMS)

  • Support for transactions

  • Support for cursors

  • Support for lazy-loading

  • Support for multiple architectures (local, remote…)

  • Built-in security models (object caching encryption…)

  • Support for batch operations

  • SQL API

  • Configurable performance

  • Still provides access to ADO.NET classes


Well, your project might need only half (or even just two or three) of these features, so be wise in choosing!

UPDATE: There are a few interesting discussions on the topic, worth reading:
Debate: O/R Mapping or Code Generation on TheServerSide.Net
Your favorite O/R Mapper? on ASP.NET forums