Hi all,
I am working in a page to allow users update the images attributes, but I have the follow error in this line:
I am working in a page to allow users update the images attributes, but I have the follow error in this line:
c.Update<IMediaFile>(image);
The error is:An exception of type 'System.InvalidOperationException' occurred in Composite.dll but was not handled in user code
Additional information: The type 'Composite.Plugins.Data.DataProviders.VirtualImageFileProvider.VirtualImageFile' is missing the attribute
And here is the code:using (var c = new DataConnection(PublicationScope.Published))
{
// Get the media folder for this entity
var folder = c.Get<IMediaFileFolder>().SingleOrDefault(f => f.KeyPath == myEntity.MyImageGalery);
if (folder != null)
{
// Get all images in folder
var images = c.Get<IImageFile>().Where(i => i.FolderPath == folder.Path);
// Now try to update my image when i found it.
foreach (var image in images)
{
if (image.Id == myImageToUpdateId)
{
image.Title = "New title";
image.Description = "New description";
// Here I face the error :(
c.Update<IMediaFile>(image);
}
}
}
}