# 18 Mart 2007 Pazar
Download here.

What's new:
  • Generics support (ActiveRecordBase<T> & ActiveRecordValidationBase<T>) (Generics is the default in the designer)
  • VB.NET seems OK (Not tested extensively).
  • Auto-sensing project type (C# or VB.NET) for code generation. You don't have to set that in the model anymore.
  • New ActiveWriter Class Details toolwindow. Can be used for rapidly adding class properties. (Idea: Ayende)
  • AR validators are supported for each property (not for field, key, composite key, timestamp or version) through a designer.
  • Ability to customize the base class. You can substitude your own base class from the editor or generate classes without a base class.
  • Ability to customize the source property name for associations. This is necessary for hierarchical objects, where they point to themselves, and using the class name resulted in un-compilable code in previous build. (Reported By: Ayende)
  • More domain consistency check through validations when opening / saving.
  • Applying pluralizing rules to the table name from the entity name if not specified. (Idea: Ayende)
  • Ability to select a property for optional DebuggerDisplay attribute.
  • Ability to decorate classes with GeneratedCodeAttribute.
  • No more setting Custom Tool property of an .actiw file to ActiveWriterCodeGenerator manually after creating the file. It's done automatically. (Thanks: Bogdan Pietroiu)
  • Key icon decorator on class shapes if a primary or composite key property exists (pure cosmetic).
  • Key icon decorator on class shapes if at least a property has validator(s) set (pure cosmetic).
  • Connector shapes changed to a more-UML-like notation.
  • Extended nullable support. You may choose between nullables through external Nullables library (1.1 style) or native nullables usage of 2.0 framework.
  • Some added properties to support changes (not all) in Castle trunk for ActiveRecordAttribute, PropertyAttribute etc.
  • Built with VS SDK v4. Includes new and improved version of DSL Tools redistributables.
What's crippled:
  • Using Output window less when doing drag-drop from Server Explorer to prevent a bug.
Known bugs / problems:
  • On international versions of VisualStudio, Drag'n drop support from Server Explorer generates entitites but not properties. You may create entities manually as a workaround.
  • Randomly, when you drag tables from Server Explorer, design surface gizes an error and cannot render any entities any more. You may save and re-open your .actiw file and it will catch up.
Screenshot below displays:
  • Validation support
  • Generic code generation
  • Nullables
  • Class details tool window
  • Visual hints on diagram elements
posted on 18 Mart 2007 Pazar 15:59:05 UTC  #   
# 12 Mart 2007 Pazartesi
I was using a private SVN for ActiveWriter and thanks to Hammet, the source is now available through Castle Contrib Repository.
Having source on an open repository is great. AW now has it's own Ohloh page :)
  • Codebase: 27,938 LOC (Most of them generated by DSL Tools, actually:)
  • Effort (est.): 7 Person Years
  • Project Cost: $362,806
I feel good! :)

posted on 12 Mart 2007 Pazartesi 10:11:10 UTC  #   
# 08 Mart 2007 Perşembe

I was doing a code review for a client and something like the following was everywhere:

    command.CommandText = "EXEC ManageBlogs;2 '" + blogName + "'";


Yes, they don't use parametrized queries. They don't even mark the command as a SP but that's the usual bad practice I happen to see everywhere. But what the heck ";2" stands for? I remember reading something like that, let's fire Books Online for Create Procedure statement (T-SQL 2000, which my client use):

CREATE PROC [ EDURE ] [ owner. ] procedure_name [ ; number ]


Is an optional integer used to group procedures of the same name so they can be dropped together with a single DROP PROCEDURE statement. For example, the procedures used with an application called orders may be named orderproc;1, orderproc;2, and so on. The statement DROP PROCEDURE orderproc drops the entire group. If the name contains delimited identifiers, the number should not be included as part of the identifier; use the appropriate delimiter around procedure_name only.

...and here's the 2005 version:

CREATE { PROC | PROCEDURE } [schema_name.] procedure_name [ ; number ]
; number

Is an optional integer that is used to group procedures of the same name. These grouped procedures can be dropped together by using one DROP PROCEDURE statement. For example, an application called orders might use procedures named orderproc;1, orderproc;2, and so on. The DROP PROCEDURE orderproc statement drops the whole group. If the name contains delimited identifiers, the number should not be included as part of the identifier; use the appropriate delimiter around only procedure_name.

Numbered stored procedures have the following restrictions:

  • Cannot use xml or CLR user-defined types as the data types.

  • Cannot create a plan guide on a numbered stored procedure.


This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

I believe this is something from the archaic days when all the development happened on the DB, that's why SP's for in the first place, isn't it? I even bet this is a fossil syntax leftover from the Sybase SQL days. Good to see that this will be dropped, but it should have already been with SQL 2005.

So, what was my client thinking? Since they use SP's extensively, they use this as a method overload. SP name stands for the static class and the number is something like different methods to call. They use 1 for INSERT, 2 for SELECT and 3 for DELETE and so on.


    @Name varchar(50)


    INSERT INTO Blogs (blog_name) VALUES (@Name)





    SELECT * FROM Blogs




    @Id int


    DELETE FROM Blogs WHERE blog_id = @Id



Exec ManageBlogs -- Error


Exec ManageBlogs 'MyBlog' -- Executes ;1


Exec ManageBlogs;1 'MyBlog' -- Executes ;1


Exec ManageBlogs;2 -- Executes ;2


Exec [ManageBlogs];2 -- Executes ;2


Exec [ManageBlogs;2] -- Error

Total chaos :) And I was quick to find ;1's that don't insert in some SP's, so they broke their own rules already.

VS 2005 designer picks up only the first one:

Hey, even Management Studio doesn't support numbered SP's:

I believe I have enough evidence to to convince my client that this is pure evil :)
posted on 08 Mart 2007 Perşembe 10:46:34 UTC  #