I've just started looking at uSiteBuilder with Umbraco 6 and was wondering what's the correct way to create a documenttype that uses DAMP and ideally get's the data from umbraco.config.
I thought perhaps creating a Converter which just returns an int then on the front end it could get all properties required via a helper or perhaps do documenttype could have a custom object with all details populated or another way?
With any approach though would it be possible to get the data from the config file to eliminate db hits?
public class IMediaListConverter : ICustomTypeConvertor
{
public Type ConvertType
{
get
{
return typeof(IList<IMedia>);
}
}
public object ConvertValueWhenRead(object inputValue)
{
if (inputValue != null && !string.IsNullOrEmpty(inputValue.ToString()))
{
var service = ApplicationContext.Current.Services.MediaService;
var list = new List<IMedia>();
foreach (var id in inputValue.ToString().Split(','))
{
var media = service.GetById(int.Parse(id));
if (media != null)
{
list.Add(media);
}
}
return list;
}
return null;
}
public object ConvertValueWhenWrite(object inputValue)
{
throw new NotImplementedException();
}
}
uSiteBuilder with DAMP
Hi,
I've just started looking at uSiteBuilder with Umbraco 6 and was wondering what's the correct way to create a documenttype that uses DAMP and ideally get's the data from umbraco.config.
I thought perhaps creating a Converter which just returns an int then on the front end it could get all properties required via a helper or perhaps do documenttype could have a custom object with all details populated or another way?
With any approach though would it be possible to get the data from the config file to eliminate db hits?
Thanks
You can use a convertor. You will have to save you DAMP to store the ID and not the XML
is working on a reply...