I have a table 'Interval' that contain multiple foreign key from "DutationType" Table I have a written a LINQ query like this
var listIntervalDurationType =
(from I in oSanEntities.Intervals
select new { I.IntervalId, I.IntervalName, I.IntevalTime,
I.DurationType开发者_如何学Go1.TypeName, I.DurationType.TypeName,
I.RetainTime });
But this give the error
An anonymous type cannot have multiple properties with the same name" because of anonymous types are not allow multiple property with same name
For resolve this error I added new property in DutationType
entity but there is a mapping error occuring.
What is the solution for that?
Try this:
var listIntervalDurationType = (from I in oSanEntities.Intervals select new {
I.IntervalId,
I.IntervalName,
I.IntevalTime,
Duration1TypeName = I.DurationType1.TypeName,
DurationTypeName = I.DurationType.TypeName,
I.RetainTime });
As message said, you can't have two properties with name TypeName
. You should also name Duration1
correctly in database diagram.
精彩评论