Mindscape Mindblog

Archive for the ‘LightSpeed’ Category

LightSpeed and LINQPad: the perfect partners

tag icon Tagged as LightSpeed, Products

LINQPad is a justly popular tool for trying out LINQ queries — it’s a great way to quickly check how a query will behave or just to check what’s in your database. (Actually, it’s a great way to test quick code snippets whether LINQy or otherwise.) LINQPad version 2 has just shipped, and in addition to the familiar LINQ to SQL support, it allows you to plug in other LINQ providers — such as LightSpeed.

We’re pleased to announce the immediate availability of a LightSpeed driver for LINQPad. This means you’ll be able to test LightSpeed queries using your LightSpeed domain model with all the speed and convenience of LINQPad.

And of course, because the driver uses LightSpeed, you’ll be able to use all the facilities of LightSpeed — for example, to perform Lucene-based full-text search from within LINQPad, or to include or exclude soft-deleted entities from the query.

To get the LightSpeed driver, just go into LINQPad, click Add Connection in the data sources list, choose View more drivers…, and choose the LightSpeed driver from the list. LINQPad will automatically download and install it. Once this is done, you’ll see LightSpeed in the Add Connection dialog. Select LightSpeed and click Next.

Now all you need to do is configure the connection with details of your database and the assembly containing your LightSpeed model. You’ll need to tell LINQPad the following details:

  • What kind of database you’re talking to (SQLite, MySQL, SQL Server, etc.)
  • The connection string for the database
  • The assembly containing the LightSpeed model (your compiled EXE or DLL)
  • The strong-typed unit of work class in that assembly (don’t forget the namespace!)

To save time, you can also use the Infer from Model button to extract this configuration information from your .lsmodel file. (You’ll still need to have built the DLL or EXE though.)

You can also set up LightSpeed context properties such as whether table names in the database are pluralised and whether to quote identifiers in queries. If you’re planning to use LINQPad to do ad hoc inserts and updates, you can also specify the identity method and timestamp strategy.

That’s it! You’re ready to get querying!

(If you have any trouble with the automatic download of the LightSpeed driver, you can instead download it directly from Mindscape here and install it using the Browse button on the “Choose a Driver” screen.)

You can get LINQPad here. And if you don’t already have LightSpeed, you can get the free Express edition here. And if there are any more features you’d like to see in the driver, let us know in the LightSpeed forum!

kick it on DotNetKicks.com

LightSpeed support for Visual Studio 2010 RC

tag icon Tagged as LightSpeed

A quick note to those that are exploring the Visual Studio 2010 release candidate – we have published a test version of the LightSpeed designer in the online store. If you are using VS 2010 RC then head over to your account page and grab the download. It installs side by side with the VS 2008 LightSpeed designer so it’s really easy to get up and running with.

There are no feature differences – just that we support VS 2010 :-)

Visual Studio 2010 showing how much it loves Mindscape LightSpeed

As this is a test version, please let us know if you have any issues by posting them in the LightSpeed forum.

I hope that helps.

Moving from LINQ to SQL to LightSpeed

tag icon Tagged as LightSpeed

LINQ to SQL has been a very popular technology with SQL Server users, providing far greater ease of use than previous Microsoft data access technologies and introducing many .NET developers to the concept of object-relational mapping. However, LINQ to SQL delivers only very basic domain modelling capabilities — no aggregates, no value objects, etc. Not to mention that it’s tightly coupled to SQL Server and that Microsoft, who are trying to encourage adoption of the Entity Framework instead, are no longer enhancing LINQ to SQL.


Figure 1. Microsoft’s roadmap for the popular LINQ to SQL framework. (Artist’s impression.)

So what if you’re hitting the limitations of LINQ to SQL and want to move on to something better? Or what if you just want to try out an alternative ORM, but don’t want to have to build a whole new model from scratch just to try it out?

First things first: this is never going to be a completely transparent process. Every ORM has different conventions for defining units of work (LINQ DataContexts), setting up configuration, and so on. Having said that, LightSpeed 3 does include a handy new feature that should cut down on the workload.

If you drag a LINQ to SQL DBML file from Solution Explorer into a LightSpeed model, we’ll load your existing LINQ classes into the LightSpeed model. Easy as that! So you can easily keep your model, including any customisations and mappings; plus now you get all the benefits of the LightSpeed designer, like database synchronisation, and can start marking up your model with LightSpeed features such as eager load aggregates.

Here’s how it looks – the original LINQ to SQL model on the left, and the LightSpeed model on the right (click for full size):

LINQ to SQL file imported into LightSpeed

A basic version of LINQ to SQL import is included in the LightSpeed 3.0 RTM. We’ve rounded out this feature a bit in the nightly builds, so if your LINQ model uses inheritance or access modifiers, you’ll want to get the updated version. As always, if you’re using a LINQ to SQL feature that the converter doesn’t handle, let us know and we’ll see what we can do.

The dynamic duo: LightSpeed & Azure

tag icon Tagged as LightSpeed, Products

Recently there have been questions from LightSpeed users asking if LightSpeed works with Azure and the answer is YES!.

Mindscape LightSpeed and Azure - The Dynamic Duo

But wait a moment, what do we really mean when we talk about “Azure”? The brand has been used to describe a whole platform of cloud technologies from Microsoft so it is important to break down how LightSpeed works with each aspect. This is an important point to keep in mind when evaluating any product that claims to work with Azure by the way!

SQL Azure

SQL Azure is the database side of the fence. Many products can talk to SQL Azure quite happily because Microsoft made the smart move of using the SQL Server engine (with some modifications) rather than some hybrid new database type. This meant that we never had to actually make a change to LightSpeed to work with SQL Azure and because of that have been a bit slow to trumpet that LightSpeed worked happily with Azure.

Working against SQL Azure with LightSpeed really is just as simple as changing your connection string to point against your .database.windows.net host. Here is an example of running our LINQ unit tests for SQL Server against a local host:

LINQ over SQL Server tests running locally

and then against SQL Azure by changing the connection string:

LINQ over SQL Server tests running remotely from Azure

The only difference is the latency involved, which reminds me not to run unit tests across the Internet again..

Windows Azure

Windows Azure can be thought of as where your application executes from – be it a website, a console application, whatever. This, interestingly enough, is the part where things can get a bit hairy for supporting the Azure platform. Windows Azure runs in two trust modes – Full Trust and Windows Azure Partial Trust (a cut down version of Medium Trust that you may have used before) and herein lies the only real challenge with supporting the Azure platform.

At the time of writing, the Microsoft documentation states that the default mode is Full Trust which is not actually correct. By default Azure will be setup to run in the Azure Partial Trust state and if you deploy a normal LightSpeed solution to it you’ll run into a problem. Now, you could set it to Full Trust, but that’s not ideal in all cases and we did some work a while back to ensure that LightSpeed happily supports Medium Trust environments.

If you wish to deploy into Windows Azure Partial Trust here’s a quick list of what to do:

1. Build your LightSpeedContext in code, do not use an app.config or web.config for the configuration.

2. Configure the LightSpeedContext to run in Partial Trust mode:

    LightSpeedContext.UseMediumTrustCompatibility = true;

3. All properties on your entities need to read/write. You can enable this in the designer using the following property (click somewhere on the background, not on an entity):

That’s it! You’re good to deploy to Windows Azure in Partial Trust, LightSpeed will chat happily with SQL Azure as if they were old friends and you can kick back with a brew :)

kick it on DotNetKicks.com

Screencast: Getting started with LightSpeed

New to LightSpeed? New members joining your team and want them to up skill? Look no further than our updated “Getting started with LightSpeed” screencast.

This screencast is designed to help new users understand how they can install LightSpeed and then be working with their data and LightSpeed entities in ~10 minutes. If you’re an experienced LightSpeed user then there won’t be much to gain from this screencast but perhaps it will be helpful to share with those less experienced. You may also prefer some of our other screencasts :-)

In approximately 10 minutes you learn:

  • How to create a new LightSpeed model
  • How to configure a LightSpeedContext
  • How to set up and use a strongly typed Unit Of Work
  • How to undertake the 4 CRUD operations
  • Bonus learning: That LightSpeed is the best choice for starting a project fast! :-)

The focus of LightSpeed has always been to get out of the way and let the developer actually get work done and we hope this video shows that.

We (and by “we” I mean “I” here ;) go through phases of putting together screencasts. If you have something you would like to see explained in true video glory then please drop a comment on this post and I’ll see what I can do. Suggestions do not have to be limited to our LightSpeed product – it can be for any of our products.

I hope that helps!