LightSpeed 2.2 released

We’re pleased to announce the release of LightSpeed 2.2, available for download today. Here’s what’s new in this release.

Stored procedure support

You can now use stored procedures to retrieve entities from the database. This allows you to use pre-defined queries, to create composite or projection entities or to incorporate complex logic in your queries. Support for stored procedures is both in the LightSpeed core product and the Visual Studio 2008 integrated designer:

Working with a stored procedure with a parameter in the LightSpeed Designer

The designer will generate helper methods for stored procedures so you don’t have to, or you can write your own stored procedure calls if you would prefer not to use the designer. In this screenshot we have dragged on a stored procedure that has a parameter “maximum” which generates the following code:

public IList<Sku> InexpensiveProductsVariable(int maximum)
  ProcedureParameter maximumParameter = new ProcedureParameter("maximum", maximum);
  ProcedureQuery procedureQuery = new ProcedureQuery("InexpensiveProductsVariable", maximumParameter);
  IList<Sku> valueToReturn = Find<Sku>(procedureQuery);
  return valueToReturn;

Stored procedures are supported for SQL Server 2005, SQL Server 2008, Oracle, MySQL and, via functions, PostgreSQL.

Watch the “working with stored procedures” screencast

Multiple views per entity type

On a related note, although LightSpeed has always been able to use views, you’ve previously had to define a specific entity type for each view. In 2.2, you can use a view as a pre-defined query, so that a single entity type can be loaded through multiple different views. For example, a Product entity could be loaded through the BargainProducts or Top10Products view as well as through the Products table.

In this screenshot we see an example of a View over the table SKU that returns the cheap items in the table:

A view representing a SKU in the LightSpeed Designer

The designer will also generate an IQueryable implementation for each View that exists in your domain model. You can then write queries against a view as you would any other table:

var items = from item in uow.CheapItems
            where item.ProductId == 1
            select item;

If you’re using .NET 2.0, which LightSpeed fully supports, and need to use the non-LINQ API:

Query query = new Query(Entity.Attribute("ProductId") == 1);
query.ViewName = "CheapItems";
IList<Sku> results = uow.Find<Sku>(query);

Watch the “working with views” screencast

ASP.NET Dynamic Data support

You can now create ASP.NET Dynamic Data sites off your LightSpeed models. This can be a great way to get an admin site or a simple intranet site up and running quickly and with little or no maintenance required. As Scott Hanselman mentioned, for the right sort of applications, “you can get a metric ass-load of work done in a short period of time.” Many folk commented on his post that it’s a shame LINQ to SQL is being put on life support but thankfully LightSpeed slots easily into place as a replacement.

Amazon SimpleDB support

LightSpeed supports Amazon SimpleDB Cloud Database from within Visual Studio

LightSpeed is the first .NET O/R Mapper to support Amazon SimpleDB out of the box. Earlier we released SimpleDB Management Tools that provides Visual Studio integration support for SimpleDB so that LightSpeed developers can work with the Visual Studio LightSpeed Designer with SimpleDB.

Read more about working with LightSpeed and SimpleDB (note: this post was prior to LightSpeed 2.2 being released)

Designer improvements

We’ve added a number of options for customising the generated code, including making properties internal and/or virtual (useful if you use a mocking framework for your unit testing), placing CLR attributes on the generated properties and even excluding properties from being generated at all (useful if you have some special domain logic that needs to go in the property implementation).

The designer can now also generate Windows Communication Foundation data contracts for you.

Finally, we’ve added a Get Started command which shows you sample LightSpeed starter code, customised to your model and language ready to copy and paste. It also provides links to online learning and support resources in case you have any more questions! To get at this screen, just right click the design surface and choose Get Started.

The getting started dialog in the LightSpeed Visual Studio Designer

And many more enhancements

Plus lots of other smaller tweaks, improvements and fixes. We always publish a complete change log of the changes made in each point release.

LightSpeed 2.2 Express Edition is available for free download, and existing customers can upgrade free at the store.

Let us know what you think – drop a comment on this post!

kick it on

8 Responses to “LightSpeed 2.2 released”

  • The Views feature looks really nice!

  • Finally! :)

    Good work guys, and very “fast” release, a great fresh start of the New Year. I have 1 question regarding stored procedures though…

    You have mentioned that with stored procedures we are able to “create composite entities”, does it mean that if I have table “Customers” and “Customer_Details” and I require an entity that is composed of these two tables, that I am able (via stored procedure and LS) to get an entity of some type (say CustomerInfo) and work with the entity in the normal LS way?

    Will there be LINQ support? What about Update/Delete operations on the CustomerInfo entity type? Will it transparently “hit” both tables?
    Or is this “procedural” type somewhat limited in what it can do?

    Thanks for answers, I understand that you can’t completely map stored procedures capabilities (which are absolutely unlimited in some databases) to a fully working object model…

    And many thanks for Lightspeed 2.2, the only thing we miss now is profiler :))

  • Great work. For those of you with a license the customer download link still states ‘Lightspeed 2.1 (9Mb)’ however when you follow the link you will get the 2.2 goodness, go and download your new version today :-)
    Can’t wait to build the next site with such an easy to use, well documented, product.

  • @John Thanks!

    @nefajciar If you drag on a stored procedure that is a projection (either of part of a table, or in the case you highlight, two tables) the designer will generate an entity for you that contains all the required properties. There is no provision currently for then transparently managing the saving of that entity back into both tables. This is a first version implementation of our stored procedures capability. You got it right with “I understand that you can’t completely map stored procedures capabilities” but we’re always happy to hear feature requests! I’ll leave Ivan answer the LINQ point.

    Missing the profiler? You can get SQL dumps of what’s going on by enabling logging. There is an example of this in the eager load screencast. Let me know if you had other ideas about profiling.

    @Nick Thanks for your feedback. I’ve fixed the issue with the store – I had updated the installers but missed updating the label of the version. Check it out now. Thanks for the positive comments :-)

  • Hello nefajciar,

    Yes, you could use a stored procedure to get composite CustomerInfo entities and work with them in the normal LightSpeed way. However, there are certain limitations in this case, as you hint in your comment.

    – You cannot combine your own query clauses with a stored procedure. Therefore, although you use LINQ against a sproc call (e.g. “from ci in uow.GetCustomerInfos() where ci.CustomerName == …”), it will *not* be executed on the database like normal LINQ queries: instead, the sproc will be executed normally, all data returned by the sproc will be returned from the database, and the LINQ query will execute client-side against the IList (using LINQ to Objects).

    – As JD says, stored procedures are currently select-only. Therefore you cannot insert, update or delete composite entities: SaveChanges will attempt to save them back to a table, which of course does not exist. (To be clear, LightSpeed itself has no notion of “composite entities” — it doesn’t know whether the entities you are loading through a sproc are normal table rows, which *are* saveable, or not — so it can’t be “smart” about this: all it can do is try to save the entities and report the failure when it happens.) I’m hoping that we’ll be able to address this limitation in 3.0, but we have a lot of features on the table for 3.0 and we can make no promises!

    Regarding profiling, as JD says, if you have ideas and suggestions above and beyond what’s currently available, let us know: now is a great time because we’re starting to think about 3.0. (We’d suggest posting in the forums rather than in blog comments because that makes it easier for other users to see what’s being suggested and to throw in their own ideas and feedback.)

  • Regarding “To get at this screen, just right click the design surface and choose Get Started.”

    I’ve just tryed to find “Get started” by pressing right mouse button in model designer but there is only Arrange and Properties.

    EDIT: I’ve just found solution for my issue before posting this comment. “Get started” option is not available when Designer is empty.

  • […] has released LightSpeed 2.2.  The product is an ORM for .NET that has nice integration with Visual […]

  • A useful set of new features in 2.2, good work!

    I’d like to be see the WCF data contract stuff extended to produce POCOs outside the WCF environment. This would be great for MVC apps where passing such a rich entity to the view layer is not ideal.

  • Leave a Reply


Join our mailer

You should join our newsletter! Sent monthly:

Back to Top