Entity Framework 4.1 - TPT Eager Loading - "ResultType of the specified expression is incompatible with the required type"

I have a model with TPT inheritance.

  • Location (abstract)
  • Street (derived from location)
  • GoogleStreetView ( 1Street 0..1 GoogleStreetView)

Each of the above has its own table.

Everything worked fine until I added the GoogleStreetView table (which is supported by PK / FK on Street).

When I try to do this:

var street = _locationRepository
   .Find()
   .OfType<Street>()
   .Include(x => x.GoogleStreetView)
   .SingleOrDefault(x => x.LocationId == 1);

I get an error message:

ResultType . ResultType "Transient.reference [xxxx.Repositories.SqlServer.Location]", "Transient.reference [xxxx.Repositories.SqlServer.Street]". : arguments [0]

...?

, , EF 4 ( RTF RTF, ).

" FK".

Repository/UoW, LocationRepository ObjectSet<Location>. LINQ.

, . .

- ?

+3
1

, .

, FK.

, :

10..1 GoogleStreetView

, :

* → ** 0..1 GoogleStreetView

, NULL-FK, GoogleStreetView.

, , GoogleStreetView Street, .

.

, EF 1 - 0..1, PK/FK.

, . , EF 4.0, 4.1???

, .

, .

+3

All Articles