Adding a Money data type to your model & the designer

This is pretty cool, but I can’t take credit for it. Jeremy, a switched on LightSpeed user has posted in our community code forum about how he integrated a custom Money type with LightSpeed to make working with money easier in his domain model. To quote his post:

Jeremy’s guide to working with a custom Money data type

With a couple of mod’s I’ve had a lot of success with this Money DataType and wanted to implement it in LightSpeed:

5 minutes later following Ivan’s article:

public class MoneyConverter : IFieldConverter
  public object ConvertFromDatabase(object databaseValue)
    return new Money((decimal)databaseValue, System.Globalization.CultureInfo.CurrentCulture);
  public object ConvertToDatabase(object value)
    //Pass in the Money.Value property as the value parameter
    return (decimal)value;

Pic of the User Defined Type properties and below see the Money DataType is available in the drop down list:

Money data type in LightSpeed

Are you a LightSpeed Ninja too?

We’ve not made a lot of noise about our community code forum, but if you have created some cool things with any of our products then we’d love to have you share them with the community. We love hearing how people are using Mindscape products to make their development more enjoyable so let us know what you’ve been building in the community code forum here.

Leave a Reply


Join our mailer

You should join our newsletter! Sent monthly:

Back to Top