1

I have projection using EF 4.0 with self tracking entities it has one data model and everything is working fine. No I need to add a second model to to connect to a different database. As soon as I add the second model into the project the build fails. I get errors like these for all the entities in the first model.

Error   12  The type 'Entities.InvoiceFile' cannot be used as type parameter 'TEntity' in the generic type or method 'DataServices.SelfTrackingEntitiesContextExtensions.ApplyChanges<TEntity>(System.Data.Objects.ObjectSet<TEntity>, TEntity)'. There is no implicit reference conversion from 'Entities.InvoiceFile' to 'DataServices.IObjectWithChangeTracker'

Any ideas?

If I remove the POCO entities for the second model the project builds fine but then I get runtime errors like this

Test method DataServicesTest.TestStatements threw exception: 
System.InvalidOperationException: Mapping and metadata information could not be found for EntityType 'Entities.Currency'.
Satish
  • 3,020
  • 7
  • 35
  • 47

1 Answers1

0

Yeah, it's not easy to do this in a single project. The easy solution is to create a new project only for the data model, then add a reference and use it that way.

Right click on the solution, choose Add -> New Project, choose a class library project, in the new project add a new Entity Framework model.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291