I have an ADO .Net Entity Data Model for my database. In this Model I have three related tables: "Users" Table containing UserId and other details. "Run" Table that contains RunId, ApproverId and other details "RunToUser" that contains UserId and RunId columns
The relationships are as follows: Users.UserId is a one to one relationship to Run.ApproverId User.UserId is many to many with RunToUser.UserId Run.RunId is many to many with RunToUser.RunId
In the Entity Model this is expressed as two tables with 2 separate relationships. the one-to-one relationship and the many-to-many relationship between Users and Run.
I have a ASP.net Formview where I want to edit the data in Run as well as the related data in Users.
Databinding is working in most cases. However when I bind to the Users table as an entitydatasource it always is using the one-to-one relationship association.
How can I force the entitydatasource to use a specific relationship association so that I can bind the data from the one-to-one mapping to a label and the many-to-many to a dataview?
I tried the "EXISTS" in the where clause whichs limits the records but it still insists on always using the one-to-one and only displays the single user in all databound controls. Here is the entitydatasource for the users:
<asp:EntityDataSource ID="edsUsers_DET" runat="server"
ConnectionString="name=MyEntities" DefaultContainerName="MyEntities"
EntitySetName="Users"
Where="EXISTS(SELECT VALUE p FROM it.Run AS p WHERE p.RunID = @RunID)" >
<WhereParameters>
<asp:ControlParameter ControlID="fvRun" Name="RunID" Type="Int32" />
</WhereParameters>
</asp:EntityDataSource>
I assume I will need two entity data sources one for the label and a second for the gridview but until I know determine how to specifiy an association I don't know how to proceed further. Thx, -J