What field do you use to store an Image?
March 7, 2013 7 Comments
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”…
And for each of these properties, you can select an “Image” control in the IDE…
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!