What field do you use to store an Image?

When I started playing with the LightSwitch HTML bits, my first experiment was to try to recreate a professional mobile site.

After only a couple of minutes (minus the many hours spent creating a JQuery slider for LightSwitch first), the result looked like this (professional corporate mobile site on the left, 3 minutes of LightSwitch on the right):



The entire thing was done fiddling around in the IDE on a single screen on queries on the same entity.  This entity had simple properties like “Name”, “IsFeaturedInSlider”, “Link” and “ImageToShow”…

About that last property: in the SL client we all found it quite logical that an “ImageToShow” property, as a business type, was stored as an “Image” (data type: binary).  In the new HTML client however, you can have an entity of business type “Image”, “String” or “Web address”…


Image 012


And for each of these properties, you can select an “Image” control in the IDE…

Image 013

So here’s the question (under the assumption that you can choose – no existing data…): what field do you use to store an Image?

My personal and totally unfounded opinion: I’m a fan of storing my images as “Image”, because of the out-of-the-box support in the SL client.  However if and only if I’m absolutely sure there will never be need for this support, then I rather store them as a “Web Address”.  When stored as a simple url, a browser will actually be smart enough to cache the images locally and not re-fetch them every time, thus gaining a small but sometimes crucial performance gain.

What’s your take on this? Leave a comment below if you agree, or disagree. (Or just want to say hi 🙂 )


Keep rocking LS!


8 thoughts on “What field do you use to store an Image?

  1. Hi Jan,

    I follow your materials whenever there is something new. Most of what you do is way beyond me but I try to keep up.

    This is probably not the right place for this, but I am a little desperate and didn’t know how else to contact you. I have a bug/strange problem with my Lightswitch OOB application as it keeps hanging randomly. Here is the link to a post I made on the forums.

    Any help/pointer would be much appreciated. Many many thanks in advance.

    Best regards,

    PS: I see you enjoyed yourself in Cambodia and Thailand, do swing by Malaysia next time (where I’m from)
    PPS: Do delete this post if you see it doesn’t fit with this posting..

  2. hi Jan nice job !
    but where is the search bar like i use to see the silvelight lightswitch.
    am i missing something ?

  3. Hi Jan, I have already adopted the uri approach when I though it was better from SL era and I also created SL controls in CLASS Extensions to support it. But, there is one more issue other than localization xpert360 mentioned and that is permissions. I know you can assign permissions to the images folder to allow only the hosting service account to read but imho in any case that security is critical you cannot beat the security a blob stored in a database can provide. One con for blobs is if one uses SQL Express the filesize limit that can easily be reached but you can get over this also by filesteam storage, which by the way gives you the option to mix blobs with uris.
    Other than that I agree that caching is a major benefit provided that your images are not actual content that can be modified but you can also solve this by storing immutable images to a different folder that the “content/editable” ones and set the expiration policy accordingly.

  4. Pingback: Beth Massi - Sharing the goodness

  5. Pingback: Beth Massi的中文博客

  6. But How do you add image when adding record ussing add edit screen. i cannt find any option from where i can browse image to upload

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s