Archive for June, 2007
Mindscape sponsors SuperHappyDevHouse
We are sponsoring the first SuperHappyDevHouse here in New Zealand! It’s a day for hackers, developers, designers et el to come together and just code it up, share some experiences and generally have a great time.

The pilot of this is an invite only affair and if you receive an invitation be sure to respond fast :)
It’s nice to be up there with sponsors like Google and Microsoft as well as other cool New Zealand companies (Actrix, Catalyst and Citylink).
Should be a great event,
– JD
LightSpeed Passes Mats’ Challenge
Mats Helander, creator of the NPersist O/R Mapper has issued a challenge to other O/R Mapper developers. To pass the challenge, an O/RM needs to be able to load a complete hierarchy of Customers, Orders and OrderLines as efficiently as possible by emitting exactly a maximum of three queries:
SELECT * FROM Customers SELECT * FROM Orders SELECT * FROM OrderLines
I’m happy to report that LightSpeed passes the test and does it with only one query. Here is the test output from running Mats’ provided test:
------ Test started: Assembly: OrmChallenge.Domain.dll ------ SELECT Customers.Id, Customers.CustomerName FROM Customers; SELECT Orders.Id, Orders.IsShipped, Orders.CustomerId FROM Orders; SELECT OrderLines.Id, OrderLines.Total, OrderLines.OrderId FROM OrderLines (25 ms) 1 passed, 0 failed, 0 skipped, took 1.28 seconds.
With LightSpeed, this is of course done using the EagerLoad attribute.
UPDATE: Here is the implementation of Mapper:
using System.Collections.Generic; using Mindscape.LightSpeed|>; using Mindscape.LightSpeed|>.Logging; namespace OrmChallenge.Domain { public class Mapper { static Mapper() { LightSpeedContext.ConnectionString = Database.ConnectionString; LightSpeedContext.Logger = new ConsoleLogger(); LightSpeedContext.PluralizeTableNames = true; } internal static IList<Customer> LoadCustomersOrdersAndOrderLines() { return Repository.Find<Customer>(); } } }
BackgroundMotion is live
Following up from the Microsoft Technical Briefings earlier this year BackgroundMotion is now live for everyone to use. While the site has been created for people to use a production manner one of the important aspects of BackgroundMotion was enabling developers to see how to develop modern solutions using Microsoft technologies.
Due to wanting to educate people we have provided the source code on Codeplex (download link below). We are also continuing to make updates and fixes as they’re needed and will upload any new changes we make. The source code and site aims to teach you how to:
- Develop with modern patterns such as the Model View Presenter (MVP)
- Use LINQ for SQL
- Write a simple Windows Vista Gadget
- Write a WCF secured Windows Vista Gadget
- Use Microsoft AJAX Extensions
- Integrate Microsoft Virtual Earth
- Leverage third party providers (Flickr, Live Spaces, SilverLight)
- And much more! :)
You can download the source off Codeplex
The live site has videos of our presentations relating to aspects of the site as well as “nugget” style videos covering a variety of topics such as our development methodology and how some of the patterns we use worked.
Nigel Parker has also create a video tutorial on how you can upload content and have it accessible in BackgroundMotion.
As with anything we do, feel free to provide feedback (on this blog or via email).
John-Daniel Trask
Getting started with Mindscape LightSpeed
Tagged as LightSpeedIn the weekend I was reworking a prototype of something I’m working on and I wanted to use LightSpeed to manage the data access and thought it would be appropriate as a code example of how to quickly and easily get started with LightSpeed. To clarify, I only needed LightSpeed for the persistence mechanism as opposed to the full domain modeling capability at this stage of my project.
The Problem
My application needed a mechanism for persisting configuration. The configuration this application stores is extensible and ideally will be extended by 3rd party plug-ins which means I needed to expose a service that can be used by these 3rd parties to store their custom configuration in a manner that will give access both to their plug-in as well as our application.
I’m also a staunch hater of >300KB XML configuration files and it’s early days in the prototype :)
Step 1: Create your model classes
I have a simple configuration entity that I wanted to be able to persist to a SQLite database (LightSpeed supports many different database engines by the way). At this stage of my prototype I’m effectively only storing a key/value pair, a human readable name and description and a type (e.g. string, color, int). In this code example you will need to reference LightSpeed in your project to gain access to the Entity<> class that we are inheriting off.
Note that LightSpeed takes care of the enum as well and will happily convert it to an int at the database level :) Too easy.
using System; using Mindscape.LightSpeed|>; namespace Mindscape.Carbon.Core.Configuration { public class ConfigurationItem: Entity<guid> { public enum ConfigValueType { STRING, INT, COLOR } private string _referenceName; private string _value; private ConfigValueType _valueType; private string _displayName; private string _description; public string ReferenceName { get { return _referenceName; } set { Set(ref _referenceName, value, "ReferenceName"); } } public string Value { get { return _value; } set { Set(ref _value, value, "Value"); } } public ConfigValueType ValueType { get { return _valueType; } set { Set(ref _valueType, value, "ValueType"); } } public string DisplayName { get { return _displayName; } set { Set(ref _displayName, value, "DisplayName"); } } public string Description { get { return _description; } set { Set(ref _description, value, "Description"); } } } }
Step 2: Create your database
Currently you create your database manually however we are working on tools to do this for you. Note that I’m using a GUID as the primary key on this table and we didn’t need to add it to the model object in the previous step, LightSpeed does this for you. You only need to supply the primary key type in Entity
In my case I was using SQLite and just used a simple create table command:
CREATE TABLE ConfigurationItem( Id GUID NOT NULL PRIMARY KEY, ReferenceName NVARCHAR(50) NOT NULL UNIQUE, Value NVARCHAR(100) NOT NULL, ValueType INT NOT NULL, DisplayName NVARCHAR(100) NOT NULL, Description NVARCHAR(1024) NOT NULL);
Step 3: Add LightSpeed to your configuration
We need to tell our application about the database that LightSpeed should be working with and we can do this in code or in the .config file for our project. In this example I’ve elected to put it into the app.config of my project.
<configSections> <section name="LightSpeed" type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" /> </configSections> <connectionStrings> <add name="ConfigDB" connectionString="Data Source=MyDatabase.db3"/> </connectionStrings> <LightSpeed dataProvider="SQLite3" connectionStringName="ConfigDB" identityMethod="Guid"/>
Step 4: Work with your data
That’s it! All the configuration work has been completed and there is no heavy XML mapping file or complex setup to tell LightSpeed about the database. The whole philosophy behind LightSpeed is to help developers get work done quickly and I hope this example and your own work with LightSpeed proves that. In following posts I will provide detail about working with your data however here is a taster of how easy it is to now put new objects into the database:
ConfigurationItem item = new ConfigurationItem(); item.ReferenceName = "MyRefName"; item.ValueType = ConfigurationItem.ConfigValueType.STRING; item.DisplayName = "Example Config"; item.Description = "This is an example configuration key"; item.Value = "example"; Repository.Add(item); Repository.CompleteUnitOfWork();
In this example I had an extremely simple model however you can appreciate that there is significantly less leg work required to get a LightSpeed solution up and running. I will post more advanced real world examples to help you gain more from working with LightSpeed in the near future. Also please leave any comments or questions you have on my blog regarding LightSpeed.
How can you use LightSpeed?
We currently are in late beta with an RTM of LightSpeed just around the corner. You can grab the download of LightSpeed from the Mindscape EAP site. You can also post in the forums to discuss any challenges that you have or to ask questions. We welcome any feedback.
Hope that helps,
– JD
![]()
BrainDump (1)
Community Code (1)
Events (6)
General (31)
Lab Samples (2)
LightSpeed (132)
MegaPack (3)
News (48)
Products (64)
Projects (4)
Screencast (6)
SharePoint (1)
Silverlight (5)
Silverlight Elements (12)
SimpleDB Management Tools (11)
Visual Studio (4)
VS File Explorer (5)
WPF (31)
WPF Diagramming (14)
WPF Elements (22)
WPF Property Grid (24)
![]()
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007





Posted by John-Daniel Trask on 27 June 2007


