The dynamic duo: LightSpeed & Azure

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 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

Tagged as LightSpeed, Products

10 Responses to “The dynamic duo: LightSpeed & Azure”

  • The dynamic duo: LightSpeed & Azure…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…

  • I don’t quite comprehend the first example (when LS application isn’t hosted in Azure cloud).

    What are you sending on wire? I know it could be some SQL Server 2008 specific protocol container, and SQL commands in it, but that is used once the application (and whole solution) is hosted in Azure Clouds, I wonder how it can be used in heterogenous environment (my server, and MS Azure database).

    What about security?

    And what about REST API? I mean it is of course much better to communicate with the DB with RESTful manner, I think Azure supports it, and it can be secured.

    Well, Azure support is indeed a great thing, as the year 2010 will be all about cloud computing!

  • The over the wire protocol is TDS, which is the native SQL client protocol. Under the hood we are using an ADO.NET SqlConnection so it is the same as connecting to a local SQL Server in that regard. Security concerns etc are for you to manage between yourself and Azure, generally I wouldnt expect you would be doing much “over the Internet” based development however, but this is no different to developing any other app over Sql Azure.

    Sql Azure has no native REST API, you may remember one from the earlier incarnation of Sql Azure (the key value based version), however this was dropped when they migrated to the fully relational model. You could create one by setting up a simple DataServices project and hosting it under Windows Azure, but then it becomes a custom solution and not one we could support reliably :)

  • […] We’ve frequently been asked to publish change logs for our nightly builds, and although it’s not very convenient for us to make that information available on a nightly basis, we thought it would be a good idea to publish the occasional round-up of recent changes. We are planning to make this a weekly thing… for some value of “weekly” that will depend on how much JD gets distracted into making Photoshops of Batman. […]

  • Here:

    you say:

    “Mindscape LightSpeed is the only .NET O/R Mapper that supports SimpleDB out of the box”

    Not having tried this out personally, is it correct to assume that means you’re actually using SimpleDB as the backing repository, with LiteSpeed sitting as an abstraction top? I can’t see how it would mean any thing else.

    Which leads me to my question, if you do this for SimpleDB, do you have plans (or do you do it already) to have TableStorage as a backstore for LiteSpeed.

    SQL Azure has some negative aspects (including price, and scaleabaility, and max size) which makes Table Storage appealing. Is there room for liteSpeed to make it a more DB like experience??


  • Hi Phil,

    We haven’t had much demand for supporting that so far however if we start getting additional interest it would certainly be bumped up the priority list. Have you considered using Amazon’s SimpleDB store?

  • We’d like to register our interest in having LightSpeed support Azure Tables.

  • Hi Matt,

    We have basic support for Windows Azure Table Storage in the current nightly builds. It is fairly simple at the moment but if you have specific feature requests then do raise them in the support forum and we’ll see what we can do!

    Couple of things you need to know to get started: (1) You must reference the LightSpeed Windows Azure provider DLL explicitly (it’s not baked into the LightSpeed DLL like most providers); (2) connection string format is “Account Name=acct_name;Key=key_base64_string;Use HTTPS=false”; (3) use the Guid identity method. Also there is no drag and drop designer support currently planned — you can still create your models in the designer of course, you just have to use the Toolbox instead of Server Explorer.

  • Beyond configuring the context, what is required to setup the Azure Table Storage to accept added entities? The table storage seems a little bit different in terms of schema requirements than a normal SQL Database. I don’t believe I can use the designer to create any schema that needs to be created, and my understanding is that any schema must be created manually in the case where one creates entities from code. As it is, when I add entities, nothing is being created (tables or rows), but I’m also not receiving any error or feedback.

  • Actually, it appears that you just have to create the tables, then the first additions will create any schema that is necessary.

    I have setup a Many to One relationship but I’m getting a “Bad Request” exception when I try to iterate through the many.

    for example:

    var companies = from c in uow.Companies
    select c;

    foreach( var cmp in companies)
    foreach(emp in cmp.Employees)

    in this trivial example, the code will print out the company name then get an exception when trying to get the employees associated with that company. If I just print out all the employees in the whole database, the company property of each employee entity is correct. Is this just not supported for Azure Table Storage yet?

  • Leave a Reply


Join our mailer

You should join our newsletter! Sent monthly:

Back to Top