Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to create several ECT with Associations between them. Been playing around with several tools and reading/watching a handful of tutorials. I have gotten my pieces to work when playing around but my main project just does not want to cooperate.

I have stripped out as much as I can from the project (I am down to just two Entities) and cannot seem to get an Association between them to work properly. The project compiles and deploys without errors, Central Admin shows the entities and associations, and even the External List shows the picker and items when showing the update form.

The problem is that the "look up" value will not render when viewing the single entity nor in Update mode. In Update mode, the textbox for the picker shows the fully qualified namespace and entity name for the entity instead of the associated value or even the FK value. In addition, if I use the picker to select a new value, after clicking OK, a "__bgxxxxxx" value is displayed back in the update form.

Oddly enough, using SQL Profile I see the query for the item but I do not see the query for the association value so as far as I can tell, the ReadList method sees the FK value but the ReadItem method thinks the field is null. I have used VS debugging to confirm that the FK value is being passed back as part of the Entity object.

To make it even more confusing, I created a brand new test project and that works perfectly. The test project is very, very similar to my main project except for some namespace differences and the way the data is loaded from the database and is passed back to via the Entity. My main project reads in the EF object and maps it to a DTO object since I need to convert GUID database values to strings so the External List can see it. The test project just reads in the database via EF and just passes that back as the ECT Entity. The GUID/String conversion has nothing to do with the Association. For that I am dealing with a nullable INT.

I used Beyond Compare to see the differences between the bdcm file and see nothing substantial. Like I said...primarily some namespace differences and versioning. Below is the bdcm from the main project. I am sure it is something I am missing so a few more pairs of eyes would be greatly appreciated.

Thank you.

<?xml version="1.0" encoding="utf-8"?>
<Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/windows/2007/BusinessDataCatalog" Name="IndicatorsOfCompromiseModel" DefaultDisplayName="IOC">
    <LobSystems>
        <LobSystem Name="IndicatorsOfCompromise" Type="DotNetAssembly">
            <LobSystemInstances>
                <LobSystemInstance Name="IndicatorsOfCompromise" DefaultDisplayName="IOC" />
            </LobSystemInstances>
            <Entities>
                <Entity Name="CompromiseIndicator" Namespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" Version="1.0.0.67" DefaultDisplayName="Compromise Indicator">
                    <Properties>
                        <Property Name="Class" Type="System.String">IOC.BCS.IndicatorsOfCompromiseConnectivityModel.CompromiseIndicatorService, IndicatorsOfCompromise</Property>
                    </Properties>
                    <Identifiers>
                        <Identifier Name="ReferenceId" TypeName="System.String" DefaultDisplayName="Id" />
                    </Identifiers>
                    <Methods>
                        <Method Name="GetAllIndicators">
                            <Parameters>
                                <Parameter Name="compromiseIndicatorList" Direction="Return">
                                    <TypeDescriptor Name="CompromiseIndicatorList" TypeName="System.Collections.Generic.IEnumerable`1[[IOC.BCS.ViewModels.CompromiseIndicator, IndicatorsOfCompromise]]" IsCollection="true">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="CompromiseIndicator" TypeName="IOC.BCS.ViewModels.CompromiseIndicator, IndicatorsOfCompromise" IsCollection="false">
                                                <TypeDescriptors>
                                                    <TypeDescriptor Name="ReferenceId" TypeName="System.String" IdentifierName="ReferenceId" ReadOnly="true" />
                                                    <TypeDescriptor Name="Value" TypeName="System.String" />
                                                    <TypeDescriptor Name="StatusId" TypeName="System.Nullable`1[[System.Int32]]" IsCollection="false" IdentifierEntityName="Status" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="StatusId" ForeignIdentifierAssociationEntityName="Status" ForeignIdentifierAssociationEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" ForeignIdentifierAssociationName="StatusToCompromiseIndicatorAssociationNavigator" />
                                                    <TypeDescriptor Name="CreationDate" TypeName="System.DateTime" IsCollection="false" />
                                                    <TypeDescriptor Name="CreationActorId" TypeName="System.String" />
                                                    <TypeDescriptor Name="LastRevisionDate" TypeName="System.DateTime" IsCollection="false" />
                                                    <TypeDescriptor Name="LastRevisionActorId" TypeName="System.String" />
                                                </TypeDescriptors>
                                            </TypeDescriptor>
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <MethodInstance Name="GetAllIndicators" Type="Finder" ReturnParameterName="compromiseIndicatorList" ReturnTypeDescriptorPath="CompromiseIndicatorList" />
                            </MethodInstances>
                        </Method>
                        <Method Name="GetIndicatorById">
                            <Parameters>
                                <Parameter Name="compromiseIndicator" Direction="Return">
                                    <TypeDescriptor Name="CompromiseIndicator" IsCollection="false" TypeName="IOC.BCS.ViewModels.CompromiseIndicator, IndicatorsOfCompromise">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="ReferenceId" IdentifierName="ReferenceId" TypeName="System.String" ReadOnly="true" />
                                            <TypeDescriptor Name="Value" TypeName="System.String" />
                                            <TypeDescriptor Name="StatusId" IsCollection="false" TypeName="System.Nullable`1[[System.Int32]]" IdentifierEntityName="Status" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="StatusId" ForeignIdentifierAssociationEntityName="Status" ForeignIdentifierAssociationEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" ForeignIdentifierAssociationName="StatusToCompromiseIndicatorAssociationNavigator" />
                                            <TypeDescriptor Name="CreationDate" IsCollection="false" TypeName="System.DateTime" ReadOnly="true" />
                                            <TypeDescriptor Name="CreationActorId" TypeName="System.String" ReadOnly="true" />
                                            <TypeDescriptor Name="LastRevisionDate" IsCollection="false" TypeName="System.DateTime" ReadOnly="true" />
                                            <TypeDescriptor Name="LastRevisionActorId" TypeName="System.String" ReadOnly="true" />
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                                <Parameter Name="referenceId" Direction="In">
                                    <TypeDescriptor Name="ReferenceId" TypeName="System.String" IdentifierEntityName="CompromiseIndicator" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="ReferenceId" />
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <MethodInstance Name="GetIndicatorById" Type="SpecificFinder" ReturnParameterName="compromiseIndicator" ReturnTypeDescriptorPath="CompromiseIndicator" />
                            </MethodInstances>
                        </Method>
                        <Method Name="Update">
                            <Parameters>
                                <Parameter Name="compromiseIndicator" Direction="In">
                                    <TypeDescriptor Name="CompromiseIndicator" IsCollection="false" TypeName="IOC.BCS.ViewModels.CompromiseIndicator, IndicatorsOfCompromise">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="ReferenceId" TypeName="System.String" IdentifierName="ReferenceId" UpdaterField="true" />
                                            <TypeDescriptor Name="Value" TypeName="System.String" UpdaterField="true" />
                                            <TypeDescriptor Name="StatusId" TypeName="System.Nullable`1[[System.Int32]]" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierEntityName="Status" IdentifierName="StatusId" ForeignIdentifierAssociationEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" ForeignIdentifierAssociationEntityName="Status" ForeignIdentifierAssociationName="StatusToCompromiseIndicatorAssociationNavigator" IsCollection="false" UpdaterField="true" />
                                            <TypeDescriptor Name="CreationDate" IsCollection="false" TypeName="System.DateTime" UpdaterField="true" />
                                            <TypeDescriptor Name="CreationActorId" TypeName="System.String" UpdaterField="true" />
                                            <TypeDescriptor Name="LastRevisionDate" IsCollection="false" TypeName="System.DateTime" UpdaterField="true" />
                                            <TypeDescriptor Name="LastRevisionActorId" TypeName="System.String" UpdaterField="true" />
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <MethodInstance Name="Update" Type="Updater" />
                            </MethodInstances>
                        </Method>
                        <Method Name="CompromiseIndicatorToStatus">
                            <Parameters>
                                <Parameter Name="referenceId" Direction="In">
                                    <TypeDescriptor Name="ReferenceId" TypeName="System.String" IdentifierEntityName="CompromiseIndicator" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="ReferenceId" ForeignIdentifierAssociationEntityName="CompromiseIndicator" ForeignIdentifierAssociationEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" ForeignIdentifierAssociationName="CompromiseIndicatorToStatusAssociationNavigator" />
                                </Parameter>
                                <Parameter Name="statusList" Direction="Return">
                                    <TypeDescriptor Name="StatusList" TypeName="System.Collections.Generic.IEnumerable`1[[Models.Status, IndicatorsOfCompromise]]" IsCollection="true">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="Status" IsCollection="false" TypeName="Models.Status, IndicatorsOfCompromise">
                                                <TypeDescriptors>
                                                    <TypeDescriptor Name="StatusId" IsCollection="false" TypeName="System.Int32" IdentifierEntityName="Status" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="StatusId" />
                                                    <TypeDescriptor Name="StatusLabel" TypeName="System.String" />
                                                </TypeDescriptors>
                                            </TypeDescriptor>
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <Association Name="CompromiseIndicatorToStatusAssociationNavigator" Type="AssociationNavigator" ReturnParameterName="statusList" ReturnTypeDescriptorPath="StatusList">
                                    <SourceEntity Name="CompromiseIndicator" Namespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" />
                                    <DestinationEntity Name="Status" Namespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" />
                                </Association>
                            </MethodInstances>
                        </Method>
                    </Methods>
                    <AssociationGroups>
                        <AssociationGroup Name="StatusToIndicatorAssociation">
                            <AssociationReference EntityName="Status" EntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" AssociationName="StatusToCompromiseIndicatorAssociationNavigator" Reverse="false" />
                            <AssociationReference AssociationName="CompromiseIndicatorToStatusAssociationNavigator" Reverse="true" />
                        </AssociationGroup>
                    </AssociationGroups>
                </Entity>
                <Entity Name="Status" Namespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" Version="1.0.0.27">
                    <Properties>
                        <Property Name="Class" Type="System.String">IOC.BCS.IndicatorsOfCompromiseConnectivityModel.StatusService, IndicatorsOfCompromise</Property>
                        <Property Name="Title" Type="System.String">StatusLabel</Property>
                    </Properties>
                    <Identifiers>
                        <Identifier Name="StatusId" TypeName="System.Int32" DefaultDisplayName="Id" />
                    </Identifiers>
                    <Methods>
                        <Method Name="GetAllStatus">
                            <Parameters>
                                <Parameter Name="statusList" Direction="Return">
                                    <TypeDescriptor Name="StatusList" TypeName="System.Collections.Generic.IEnumerable`1[[Models.Status, IndicatorsOfCompromise]]" IsCollection="true">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="Status" TypeName="Models.Status, IndicatorsOfCompromise" IsCollection="false">
                                                <TypeDescriptors>
                                                    <TypeDescriptor Name="StatusId" TypeName="System.Int32" IsCollection="false" IdentifierName="StatusId" />
                                                    <TypeDescriptor Name="StatusLabel" TypeName="System.String">
                                                        <Properties>
                                                            <Property Name="ShowInPicker" Type="System.Boolean">true</Property>
                                                        </Properties>
                                                    </TypeDescriptor>
                                                </TypeDescriptors>
                                            </TypeDescriptor>
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <MethodInstance Name="GetAllStatus" Type="Finder" ReturnParameterName="statusList" ReturnTypeDescriptorPath="StatusList" />
                            </MethodInstances>
                        </Method>
                        <Method Name="GetStatusById">
                            <Parameters>
                                <Parameter Name="status" Direction="Return">
                                    <TypeDescriptor Name="Status" IsCollection="false" TypeName="Models.Status, IndicatorsOfCompromise">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="StatusId" IdentifierName="StatusId" IsCollection="false" TypeName="System.Int32" />
                                            <TypeDescriptor Name="StatusLabel" TypeName="System.String">
                                                <Properties>
                                                    <Property Name="ShowInPicker" Type="System.Boolean">true</Property>
                                                </Properties>
                                            </TypeDescriptor>
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                                <Parameter Name="statusId" Direction="In">
                                    <TypeDescriptor Name="StatusId" TypeName="System.Int32" IdentifierEntityName="Status" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="StatusId" />
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <MethodInstance Name="GetStatusById" Type="SpecificFinder" ReturnParameterName="status" ReturnTypeDescriptorPath="Status" />
                            </MethodInstances>
                        </Method>
                        <Method Name="StatusToCompromiseIndicator">
                            <Parameters>
                                <Parameter Name="statusId" Direction="In">
                                    <TypeDescriptor Name="StatusId" TypeName="System.Int32" IdentifierEntityName="Status" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="StatusId" ForeignIdentifierAssociationEntityName="Status" ForeignIdentifierAssociationEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" ForeignIdentifierAssociationName="StatusToCompromiseIndicatorAssociationNavigator" />
                                </Parameter>
                                <Parameter Name="compromiseIndicatorList" Direction="Return">
                                    <TypeDescriptor Name="CompromiseIndicatorList" TypeName="System.Collections.Generic.IEnumerable`1[[IOC.BCS.ViewModels.CompromiseIndicator, IndicatorsOfCompromise]]" IsCollection="true">
                                        <TypeDescriptors>
                                            <TypeDescriptor Name="CompromiseIndicator" IsCollection="false" TypeName="IOC.BCS.ViewModels.CompromiseIndicator, IndicatorsOfCompromise">
                                                <TypeDescriptors>
                                                    <TypeDescriptor Name="ReferenceId" TypeName="System.String" IdentifierEntityName="CompromiseIndicator" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierName="ReferenceId" />
                                                    <TypeDescriptor Name="Value" TypeName="System.String" />
                                                    <TypeDescriptor Name="StatusId" IdentifierEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" IdentifierEntityName="Status" IdentifierName="StatusId" ForeignIdentifierAssociationEntityNamespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" ForeignIdentifierAssociationEntityName="Status" ForeignIdentifierAssociationName="StatusToCompromiseIndicatorAssociationNavigator" IsCollection="false" TypeName="System.Nullable`1[[System.Int32]]" />
                                                    <TypeDescriptor Name="CreationDate" IsCollection="false" ReadOnly="true" TypeName="System.DateTime" />
                                                    <TypeDescriptor Name="CreationActorId" ReadOnly="true" TypeName="System.String" />
                                                    <TypeDescriptor Name="LastRevisionDate" IsCollection="false" ReadOnly="true" TypeName="System.DateTime" />
                                                    <TypeDescriptor Name="LastRevisionActorId" ReadOnly="true" TypeName="System.String" />
                                                </TypeDescriptors>
                                            </TypeDescriptor>
                                        </TypeDescriptors>
                                    </TypeDescriptor>
                                </Parameter>
                            </Parameters>
                            <MethodInstances>
                                <Association Name="StatusToCompromiseIndicatorAssociationNavigator" Type="AssociationNavigator" ReturnParameterName="compromiseIndicatorList" ReturnTypeDescriptorPath="CompromiseIndicatorList">
                                    <SourceEntity Name="Status" Namespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" />
                                    <DestinationEntity Name="CompromiseIndicator" Namespace="IOC.BCS.IndicatorsOfCompromiseConnectivityModel" />
                                </Association>
                            </MethodInstances>
                        </Method>
                    </Methods>
                </Entity>
            </Entities>
        </LobSystem>
    </LobSystems>
</Model>

Update:

I got it working but I have no idea why this version works. Instead of FK Association methods (the ones related to the Status lookup) returning an EF object (an object inheriting from System.Data.Objects.EntityObject) I created a Status DTO object and mapped the properties over. That object works perfectly. I do not get it...

share|improve this question
    
You could write your solution as answer and mark it as answer. –  Shegit Brahm Apr 17 '12 at 7:48
    
I guess I could but I have no idea why it is the solution. The only thing I can think of is that BCS does not work directly with EF objects. –  Jason Apr 17 '12 at 14:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.