Domanda

I have a defined a content type called SPVideoDataItem containing those two fields:

<Field ID="{487F2AD6-D9D6-47AA-AA99-B3FFF893E689}" Name="LUVideoQuality" Group="Custom Columns" Type="Lookup" DisplayName="Video Quality" List="Lists/GlobalVideoQualityList" ShowField="Title" PrependId="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE"/>
<Field ID="{F348A825-764D-41EE-AF92-8CF1DC246E47}" Name="LUVideoTitle" Group="Custom Columns" Type="Lookup" DisplayName="Video Title"  List="Lists/VideoItemList" ShowInEditForm="TRUE"  ShowInNewForm="TRUE" ShowField="VideoItemTitle" PrependId="TRUE" Required="TRUE"/>

For LUVideoQuality I get a property in a class called VideoItemDataListSPVideoDataItem:

public SPVideoQualityItem VideoQuality

which exposes a EntityRef-Member, so I can access all properties of SPVideoQualityItem.

However, for LUVideoTitle spmetal just generates two properties in the parent class SPVideoDataItem

public string VideoTitleVideoItemTitle
public System.Nullable<int> VideoTitleId 

where I can only access title and ID.

I wonder why spmetal handles this two lookups differently. Can anyone explain this behaviour? I would prefer that all lookups are handled like LUVideoQuality in my example.

È stato utile?

Soluzione

I've encountered the same issue.

When I let go of the principle to create a separate content type and just created a list based on content type Item it did generate the entity refs.

Altri suggerimenti

Apparently it has something to do with the "WebId" property of the lookup fields. A colleague told me that they got it working by adding

WebId="~sitecollection" 

to all lookup fields in the content type definitions (Elements.xml). Im not marking this as an answer because I did not check if it is working now because of this attribute or some other change in the definitions.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top