Linq to sql binds objects with multiple ID fields

I am working on a project at work, which is pretty much the commissioning manager, and I cannot figure out how to properly bind the Items table in linq to sql.

I have a package details table that has (among other things)

DepartmentID, CategoryID, ItemID

And the Items table (actually represents a database as it is from another database and is read only in this application) also has these 3 fields, but when I add an association with these three fields, it does not add it as a property of the PackageDetail class

Am I doing something wrong with the association? all solitary ones do an excellent job for them ...

+3
source share
5 answers

ID ? , , . , .

+1

, . , , ?

LINQ to SQL DBML XML-. :

<Association Name="Schedule_Profile" Member="Schedule" ThisKey="ScheduleID" Type="Schedule" IsForeignKey="true" />

, , ThisKey csv. OtherKey .

0
source

It looks like you could just use the ItemId and ignore the other 2, as this is the most specific qualifier - in other words, the department and category are completely defined by itemId.

0
source

You meant a query like this.

var result = from table in dbContext.table1 join table2 in dbContext.table2 join new { table.DepartmentID, table.CategoryID, table.ItemID} equals new {table2.DepartmentID, table2.CategoryID, table2.ItemID}
select table;
0
source

Source: https://habr.com/ru/post/1714750/


All Articles