Tuesday, June 7, 2011

DataObjects.Net Entity Model Designer - Alpha stage goes to final

Some times ago first version of DataObjects.Net Entity Model Designer was published. I decided to set released version in some "alpha" stage. The reason is that i just start learning DSL tools with T4 templates generator and i want that users of this designer know the quality of tool.

Now, released version is the 6th alpha version of tool.
Whats new in this release:

Features :

Take a look at important features included in this release

Feature Redesign Add Association dialog to be simpler is the interested one (at least from better visual usage). Dialog contains also preview of what you get when you create such association.
Supports 2 modes of creating associations:

  • Simple Association:

  • Advanced Association

Next important feature is Generate POCO/DTO classes from entity model.
  • Means T4 template will generate DTO classes as an mirror to generated classes for "real" entity classes. 
  • An bonus T4 template is capable of generating "mapping builder" which is responsible for mapping "real" entity classes with DTO classes and is required by DO to be able to transform data from/to real entity and DTO.

Developers Wanted

DataObjects.Net Entity Model Designer received a long way (at least from my side) and i want to close down "alpha" stage. Before closing alpha stage tool needs to pass as many tests as it can get.

And there is my appeal to developers which uses DataObjects.Net to develop applications to help testing basic functionality of Designer and also of T4 template if generate valid classes.

Just download latest version from codeplex.com and take some time to test it:
DataObjects.Net Entity Model Designer v1.0.5.0 

If you found some bugs or have an idea, just create new issue in codeplex site

Monday, March 28, 2011

DataObjects.Net Entity Model Designer - Model First (Part 2)

Previous parts: 
Part 1 - Prologue.

As i mention in previous part of this article, my first attempt to create DO.Net entity classes generator fails because of complexity of tool itself and because of few other things.

Then i go another way, way of DSL designer. Begin was so hard due to lack of detailed documentation and really simple tutorials how to start with DSL (yes there are some articles, samples, but they aren't simple to understand in short time, and have no good examples either). I have devoted more time to learn DSL from scratch. Finally i released public alpha version of DSL designer to model DataObjects.Net entities.

Project Plan

First version (and subversion's) will be focused to make bullet-proof designer and T4 template to model first DataObjects.Net entities.
In other words to bring minimal set of required features to DSL designer and T4 template and fix bugs founded in those versions.

Next major(minor?) version will bring new feature - Import Database Schema (extracts existing database schema into model diagram). There are no details when i start to develop such version, it depends on finalizing first version (as described above).

Project License and Download

Project itself is freeware, but it is not provided with source codes.
Product is hosted on codeplex.com - http://doemd.codeplex.com. You can download MSI installer of project on codeplex.com site, under tab Downloads.

Features supported so far in first version of DataObjects.Net Entity Model Designer

Designer support 4 kind of persistent type:
  • Interface
  • Entity
  • Structure
  • Typed EntitySet

Inheritance (single or multiple) is supported:
  • Interface, Entity and Structure can define multiple (0..*) inheritance from other Interfaces 
    • equivalent to C# where class or interface can inherit multiple interfaces
  • Entity can defined base entity type
    • equivalent to C# where class can inherit only from one other class

Property Associations:
  • Persistent types (all but Typed EntitySet) can define reference property with multiplicity:
    • Zero to One (0..1)
    • One (1)
    • Many (0..*)
  • Property Association defined as multiplicity Many can define custom EntitySet type (Typed EntitySet)

Typed EntitySet (custom EntitySet):
  • Persistent type of kind Typed EntitySet will generate collection like class derived from Xtensive's EntitySet. This allows customization on such custom type.

Read more in Documentation on codeplex.

      DataObjects.Net Entity Model Designer - Prologue (Part 1)

      As i wrote earlier, i discovered best ORM framework - DataObjects.Net.
      After some time working with this framework on small projects i want to jump to big old one project with approx. ~500 tables divided into ~10 schemas. Then i realized that it wil cost too much time for me to write business entities for these 500 tables (including huge inheritance tree, relationship, associations,...). My first idea was to found some existing tool/addin, something to help me generating such business classes from existing database. Result was, there isn't any tool which support DataObjects.Net as target framework.

      If i need some tool/application and can't find it, i will try to write such application on my own (sure i don't write new Office or something like that :-)). My thoughts are that many developers do the same thing.

      I know nothing about Visual Studio DSL designers, so i decided to create Windows application. I started to write application where i can enter connection details (only MS-SQL servers), select required tables/columns and finish button to generate business classes from existing database. Next feature of tool was to read relationships from db and generate association properties with [Association] attributes on it.

      Firstly i think it is easy to do such feature, list of associations where i define source, target, properties of each (Multiplicity, On owner/target remove action, etc...). Again everything works like a charm, generated classes now contains reference properties, simple and advanced (multiplicity Many *, as Entity Sets) with required [Association] attribute(s).

      Whats the problem here, you can ask, give us such tool, right now. Well No!
      I figured out one big problem with such tool, when i import database with ~ 500 tables into tool, that list of generated associations (yes tool will automatically scan and detect relationships and create associations) was too big, for my db about 50 generated associations (where the tool cannot detect all kind of possible associations).
      Now when i look at associations list i have about ~50 rows of associations with information's like Source Property, Target Property, Source Multiplicity, Target Multiplicity, Source On Owner Remove Action... 50 rows of flat view on associations. Starting to review all of this generated associations, i lost myself on about half.I cant imagine visually in my mind association tree on these associations - some kind of "Diagram" to see which entity is associated to other one, in nice visual form.

      Here story of old "DO.Net Generator tool" ends, and new story of DataObjects.Net Entity Model Designer starts.

      Next part 2: Model First

      Tuesday, April 13, 2010

      Visual Studio Dark Scheme compatible with Resharper 5 (and color identifiers)

      Just installed Resharper 5, and try to use dark scheme from Dark IDE Colors v2.0 . But it looks ugly, because resharper 5 brings new color identifiers.

      I make some small changes to this scheme and now is available for download.

      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

      Wednesday, July 8, 2009

      Devexpress ASPxPopupControl content loading advanced example

      Using ASPxPopupControl to dynamically load user control(ascx) to popup content, you found that size of popup control is auto-resized to fit the size of loaded control (see example from devexpress code central - E346).

      This is because we get html code of ascx control using ASPxCallback.GetRenderResult, which is later set to popup control using SetContentHtml function - this will internally set innerHTML of div with html code of our user control (ascx).

      Using ASPxPopupControl to dynamically load aspx page (not user control) to popup content using function SetContentUrl, you have problem - NO auto-resize of popup content area to respect size of loaded aspx page within popup iframe.

      Last weeks i try to do my best to make auto-resizing feature when popup control loads aspx page using
      Finally i have an solution with such feature as an advanced example demo.

      You can download example demo from

      Please feel free to add comment if you have any question.