What return value to use to match two different kinds of Types
I'm using LINQ towards my MSSQL database. I have the TypeOfMetaData-table, the UserMetaData-table and the MetaDataHasType-table that has foreign-keys from the TypeOfMetaData- and the UserMetaData-table. What I need to do a method to get all MetaData and Types and return them. The problem is that I don't know what kind of return value I should use to be able to match the correct rows together.
开发者_如何学GoThanks for the help,
wardh
You could use an Anonymous Type (var) to store the result:
var result =
yourDataContext
.UserMetaData_Table
.Select(
userMetaData =>
new
{
UserMetaData = userMetaData,
Types = userMetaData.MetaDataHasTypes.Select(types => types.TypeOfMetaData),
})
.ToArray();
If this isn't what you want, could you update you question to with an example of the data context and the classes you have and what you have tried so far.
精彩评论