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.


Consuming .net Assemblies from VB6

-Basic COM interop

I spent a lot of time with my first interop project going through all the resources I could find on the subject. I found that many of the articles I managed to dig up did not cover the basics needed to get a simple ineterop project up and running.
Another lack in the existing library of interop articles is the bias towards writing articles describing the consumtion of COM libraries from .Net. My need has allways been the other way around: consuming .Net assemblies from VB6.
The best guide I found where a 15 seconds article by Patrick Steele: COM Interop Exposed. This article adressed most, if not all, of the issues i ran into with my first interop project. It also goes through the background needed for someone not previously exposed to the COM way of thinking to understand enough of what's going on behind the scenes.
My goal for this article is to make a basic step by step guide on getting the very simplest interop project up and running in your development enviroment.


Subscribe to RSS - COM