Sharepoint 2010 and lookup with picker -> LINQ mapping

Aug 16, 2010 at 2:52 PM

hello everybody,

I have an issue with Lookup with picker for sharepoint 2010, when working with LINQ to Sharepoint. My list MyList contains lookup with picker column. I generated schema with SpMetal tool, but it was excepted. So I added it as ordinary lookup column as followed: 

1. [Microsoft.SharePoint.Linq.AssociationAttribute(Name = "Spis", Storage = "_spis", MultivalueType = Microsoft.SharePoint.Linq.AssociationType.Single, List = "Spisy")]    

2. public SpisyItem Spis  

3. {        

4. get {            return this._spis.GetEntity();        }        

5.        set {            this._spis.SetEntity(value);        }    }

... and some more changes. Critical is point at line 5 when I write query with Where conditions it returns count and everything, but when I ask for concrete item in list in column Spis, then it returns:

Object reference not set to an instance of an object.

Can anybody help me with this issue, how to define in linq shcema LookUp with picker entity. (with Spmetal to generate or manually to add to code)

Thank You







Aug 16, 2010 at 2:58 PM

...additional info is that lookup with picker column contains information, so this problem points to somewhere deeper  ...