Extending the Lokad DSL tool


Photo by Al_HikesAZ (CC license)

What, where, why

I need to fast forward past several planned blog topics to establish a context for this one:

  • I'm working on a legacy VB6 app that is about to get some ddd, messaging love in the process of moving off the VB6 platform.
  • I've landed on using the Lokad DSL tool (Github) for defining messages.

The Lokad dsl tool does what it says on the box: It lets you define immutable, datacontract serializeable, message classes. But without all the mind numbing typing normally required to write out such classes in C#.

DSL code:

AddSecurityPassword?(SecurityId id, string displayName, string login, string password)

Becomes c# code:

[DataContract(Namespace = "Sample")]
public partial class AddSecurityPassword : ICommand<SecurityId>
    [DataMember(Order = 1)] public SecurityId Id { get; private set; }
    [DataMember(Order = 2)] public string DisplayName { get; private set; }
    [DataMember(Order = 3)] public string Login { get; private set; }
    [DataMember(Order = 4)] public string Password { get; private set; }
    AddSecurityPassword () {}
    public AddSecurityPassword (SecurityId id, string displayName, string login, string password)
        Id = id;
        DisplayName = displayName;
        Login = login;
        Password = password;

But I needed more

There is another branch of c# coding that requires a lot of typing:
COM interop code.


Subscribe to RSS - C#