When i try to use the Linq in my SharePoint 2010 custom web part, i try to use the SPMetal.exe to generate the classes which is required for the Linq, but unfortunately its not generating the members for the publishing image fields and created by/Modified by columns. I found a good article here, which is says that we need to add the attributes manually in-order to achieve this functionalities.
The following is the code snippet which we need to add into the class file which is generated by SPMetal.exe .
[System.Runtime.Serialization.DataMemberAttribute()]
private Microsoft.SharePoint.Publishing.Fields.ImageFieldValue _publishingRollupImage;
[Microsoft.SharePoint.Linq.ColumnAttribute(Name = “PublishingRollupImage”, Storage = “_publishingRollupImage”, FieldType = “Image”)]
public Microsoft.SharePoint.Publishing.Fields.ImageFieldValue PublishingRollupImage
{
get
{
return _publishingRollupImage;
}
set
{
if (value != this._publishingRollupImage)
{
this.OnPropertyChanging(“PublishingRollupImage”, _publishingRollupImage);
this._publishingRollupImage = value;
this.OnPropertyChanged(“PublishingRollupImage”);
}
}
}
Thanks to the author Billets liés who published the very good article.