A couple of days ago I dropped a teaser on my blog about an upcoming addition for LightSpeed 2.0 – the introduction of an design surface for Visual Studio which allows you to visually work with your LightSpeed models.
This feature has been added directly from feedback you gave us which asked us to consider code generation and visual modeling capabilities for LightSpeed to make it even easier to build up your models, particularly when working against an existing database schema (or a database schema you are maintaining on the side).
So with LightSpeed 2.0 we will be shipping 2 new additions:
1. A command line generation tool (think SQLMetal) which allows you to target an existing database and generate your model classes based on the existing schema. You can also use this to progressively regenerate if you are evolving your schema.
2. An add-in for Visual Studio 2008 which gives you the visual design surface. Let me elaborate on this a bit more..
Once you install the LightSpeed Designer you can add LightSpeed Model (.lsmodel) files to your project. These will hold the XML based definition of our model.
Opening our LightSpeed Model presents a design surface, a toolbox and a property pane for tweaking our entities. We support manipulating Entities through the design surface giving you the full flexibility you would expect when working with LightSpeed entities such as setting Validators, toggling EagerLoad behavior and specifying aggregate or back reference names.
Using the design surface is easy – you can start by using the Server Explorer and connecting to a local database. Tables can then be dragged on to the surface as Entities.
The Designer has some smarts, understanding the conventions of LightSpeed; So if we drag a second table called Team on to the surface, which already has a relationship to Employee defined in the database, and has the appropriate Id column defined – then the designer wires up and displays the relationship.
The output of all of this work is our model classes. Behind the scenes when we compile our project, a background code generation runs and updates a class file containing the definition of our model. We can extend these using partial classes if we have some customizations that we don’t want to be obliterated by the codegen.
Here is an example of some of the code it produces:
Both of these new additions are still in beta and we are just about to start getting them into the hands of our LightSpeed 2.0 beta testers for feedback. If you are keen to have a play, drop us a line and we can get you on to the beta program :)