I’ve got two tables in SQL Server, say A and B. B is a list of documents, and A contains data indicating whether a project should include a row in B.
A
___________
AId int PK,
BId int,
Include bit
B
___________
BId int PK,
BDocNumber varchar(10),
BName varchar(128)
I have POCOs for A and B, but ultimately what I’m after is something I can bind to a devExpress grid that contains the data from both (BDocNumber, BName, Include)
-
I can set up B as a navigation property, but I don’t know a way to flatten that out for the grid (DevExpress ASPxGridView, server mode)
-
I’ve also looked into entity splitting, but it appears that won’t work since I want to join on BId instead of AId.
A solution to either 1 or 2 is acceptable, but learning about both would be awesome.
Thanks
What you have is a “has-a” relationship or a one-to-one navigation property in A to B that you want to access in your DevExpress Grid. You can do this by setting your FieldName property to your NavigationProperty.FieldName
Say for a one-to-one relationship of Persont to Address like the following:
Your GridView in your aspx page to include both the Person and the StreeAddress property of the Address navigation property would look like this
In this case, Person being table A and Address being table B. You are binding your gridview on A so then you would be setting your field name to B.FieldToDisplay.
Hope this helps!