Is there a way to use EF4 to map a column to multiple tables?

I have the need to reduce the number of tables in the database being used as the base for Entity Framework 4.0.  So we need to use a single the activity table, for example, even though there are four tables which have entities: Manager, Employee, Department and Division.

The activity table holds the activity_id and activity_description for those four categories even though they have nothing in common.  So we are trying to use EF4 to have a single column point to any of four tables, differentiated only by their foreign keys.

Here are sample primary keys for the 4 tables.

Is there a way for EF4 to know that the MAN2011001 is a foreign key to the Managers table?

I am having a hard time with this test since it seems like this will NOT be a normalized database.

Please chime in.

curiouswebsterSoftware EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
1) Entity framework should support modeling, which doesn't necessary have to strictly adhere to the database structure.

2) The Entity Data Model creates an abstraction from the database structure.

3) The Entity Framework supports inheritance and complex types:

• Inheritance: entity types can be defined so they inherit from other types (e.g. Employee could inherit from Contact). This kind of inheritance is strictly structural, meaning that there is no "behavior" inherited as it happens in object-oriented programming languages. What's in inherited is the structure of the base entity type; in addition to inheriting its structure, a instances of the derived entity type satisfy the "is a" relationship when tested against the base entity type.

• Complex types: in addition to the usual scalar types supported by most databases, the EDM supports the definition of complex types and their use as members of entity types. For example, you could define an Address complex type that has StreetAddress, City and State properties and then add a property of type Address to the Contact entity type.


The ADO.NET Entity Framework Overview

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
curiouswebsterSoftware EngineerAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.