I am using a view to return a complex search query. When I usin linq to query against EF it is returning the same row 3 times(the actual rowcount is correct).
using LinqPad I have run the same linq against my ef entity and the actual database view.
ReadmitPatientList
.AsQueryable()
.Where("PatientLastName.StartsWith(\"cooper\")")
.OrderBy (rpl => rpl.PatientLastName)
.Dump();
That is the linq I am using for both.
linqpad shows the lambda as this: EF:
ReadmitPatientList.MergeAs (AppendOnly)
.Where ( => .PatientLastName.StartsWith ("cooper"))
.OrderBy (rpl => rpl.PatientLastName)
DB
ReadmitPatientList
.Where ( => .PatientLastName.StartsWith ("cooper"))
.OrderBy (rpl => rpl.PatientLastName)
I cannot post the results...but EF returns three rows of the same record. DB returns 3 rows of individual records. As does my sql query.
What about my EF LINQ do I need to change to make it work correctly?
The sql code that is generated by the EF Linq query Actually returns the correct results if run in SQL explorer.