I'm using EF4 and I've got two entities that I wish to map to the same POCO
. I'm not sure how I can do this.
Entity 1 → Foo (this represents a table FOO in the db)
POCO → FooEntity 2 → FooView (this represents a view FooView in the db)
POCO → Foo
I understand that I need to do something like
IObjectSet<Foo> _foos = CreateObjectSet<Foo>();
// Note spelling of the Entity.
IObjectSet<Foo> _foosView = CreateObjectSet<Foo>("FooViews");
But when i try this, it does compile, but it fails with the following exception:
System.ArgumentException: System.ArgumentException: The specified entity type, 'MyProject.Core.Foo', does not match the type 'EntityFramework.SqlServerModel.FoosView' from the EntitySet 'FoosViews'.
Any suggestions?