Tuesday, December 1, 2009

Intellisense support for DataObjects.Net 4 storage configuration into Visual Studio

Last days i wrote article about discovering DataObjects.Net 4 (Discovering Best ORM Framework - DataObjects.Net 4) and i choose this framework as my orm tool.
When working with this tool, i'm hang on writing configuration for storage into app.config(web.config).
Missing intellisense for this storage configuration elements.

I do some research myself how can i add intellisense support for custom config section and found this great designer for Visual Studio - Configuration Section Designer. I use this designer to visually design whole ConfigurationSection(namespace: Xtensive.Storage.Configuration.Elements) class from DO4 library.

Here is what i prepare for you:
  • Console installation program which installs xsd schema into Visual Studio 2008
    - close all running instances of Visual Studio
    - run DO4ConfigSchemaInstall.exe - this will automatically installs file DataObjectsNet4.xsd into Visual Studio schemas folder (C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas) and add association element into catalog.xml
  • File DataObjectsNet4.xsd has complete schema definition for storage configuration, if you want to modify something on your side

Important note:
Name of config section must be named Xtensive.Storage to intellisense work.



Discovering Best ORM Framework - DataObjects.Net 4

This month (November 2009) i am searching for some really good ORM framework for .NET.
My conditions was simple & clear:
  1. Easy to learn how specified ORM tool works
  2. Compatible with latest .NET framework (3.5)
    This means that ORM tool is using and supports latest language features like generics, linq, etc...
  3. Good startup tutorials and/or examples
  4. Useful documentation
  5. Support for LINQ queries
  6. Free for non-commercial usage + source code if possible
  7. Integration to Visual Studio (visual designer if possible)
I've read many articles, comparisons and others useful informations about bunch of ORM frameworks. But my high priority condition was point 5 (to support LINQ querying as much as possible).

At first my choice was NHibernate, pretty good stable framework with source code. Walk through all conditions points, each condition was +- good enough, but point 5 does not satisfied me, not at all. NHibernate does not works well with LINQ queries. You can check it at ORM BATTLE.NET, in LINQ Implementation Scorecard, where NHibernate was only 29.9 points out of 100. Yes, i know that it is first "first/initial" support of LINQ build into NHibernate, but in market, there are too many ORM tools with LINQ support much better than NHibernate has. Then started to think i have no other choice, only to start using LINQ 2 SQL (from Microsoft).

Sun is shining...within the site (orm battle net) i found ORM tool called DataObjects.Net 4. Its scorecard has 100 points in LINQ support. Interesting! I must test it before i made final choice.

Lets have a look at my conditions against DataObjects.Net 4:
  1. Easy to learn how specified ORM tool works
    - Take a look at wiki web site of DataObjects.NET 4
    - Simple page How it works - it shows you how to work with DO4 in first touch, too many unknown features there, but you can imagine how it works (as page title says)
    - Another page Manual - which is some kind of on-line help, but much better, good reading for new users of DO4 (like me) - comprehensive information how DO4 works and what you must know to use all advantages of this great ORM tool (authors makes good job with this manual, even if it is not completed now)
  2. Compabitle with latest .NET framework (3.5)
    - This is completely true, even examples are made upon NET 3.5
    - WCF Data Services (ADO.NET Data Services/Astoria) working example with Silverligth client
  3. Good startup tutorials and/or examples
    - Wiki page Step-by-step guide to DataObjects.Net v4.0 - section Getting started - when you walk through this tutorial, download and run attached examples, then you have really good start-point to use DO4 in your own project(s) !
  4. Useful documentation
    - This is the only weak part of DO4, just Class Reference without really useful descriptions and/or examples within specified classes, objects, etc...
    - But i've heard that guys are hard working on better help
  5. Support for LINQ queries
    - Nothing to say, ITS PURE DIAMOND (proved in ORM BATTLE.NET)
    - Wiki page LINQ (Language Integrated Query) - describing LINQ queries against DataObjects.Net
    - In the latest version added new feature called "subquery batching" - for more information read New feature of DataObjects.Net v4.1: subquery batching
  6. Free for non-commercial usage
    - DataObjects.Net is distributed under GPL v3 license for free, more information - GPL license
    - Source code is hosted on "google code", more information - Building DataObjects.Net from source code
  7. Integration to Visual Studio (visual designer if possible)
    - There are installed project templates (C#): DO Model Project, DO Console Application, DO Web Application, DO WPF Application, DO Unit Tests. Each project type has setup required references to installed DataObjects.Net assemblies
    - In current version there is no visual designer support, but they starting to implement this - Visual tools: model designer & profiler
And if you still does not have enought information, you can visit these sites:
  • DataObjects.Net Team Blog - useful collected informations about all stuff according to DataObjects.Net framework
  • Alex Yakunin's blog - most active blogging developer i seen last few years :-) All articles have comprehensive information how to work with DO4