Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:40:40+00:00 2026-05-27T16:40:40+00:00

i have a question about EF4 and want to explain it by an example

  • 0

i have a question about EF4 and want to explain it by an example :

class User
{

    public int Type;
    public object Pointer;

}


class Admin
{

    public Username;
    public Password;
    ...

}

class Manager
{

    public Username;
    public Password;
    ...

}

class Member
{

    public Username;
    public Password;
    ...

}

I want to design this :
look at the User class , if User.Type == 1 I want to User.Pointer points to a object of Admin class and if User.Type == 2 I want to User.Pointer points to a object of Manager class and last , if User.Type == 3 i want to User.Pointer points to a object of Member class.

but i want to know it is possible to design this in EF4?How ? is there any solution to design something like that ? can I get some help of Map Details window in Visual Studio 2010 to do that? i need advice friends , l an waiting 🙂

regards , Ali

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:40:40+00:00Added an answer on May 27, 2026 at 4:40 pm

    Yes this is possible in EF 4 but a little different then what you are trying to do now.

    Instead of making separate classes for each user type and defining properties like UserName and Password on each of them, you can use inheritance.

    If you create a base class User and define UserName and Password on them, you can inherit all the other user types from User.

    EF knows how to map this to a database and uses a discriminator column for it, just like you said, where a certain index points to a class type. The Mapping Details window, is indeed the window that can help you. Here you can specify what the discriminator column is and which row should point to which entity.

    Here is some documentation that can help you further if you use an Entity Model, or here if you use the Code First approach.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have question about removing element from QList. myclass.h: class node2D : public QObject
I have a question about django content_types In the example of filtering a QuerySet
I have question about integrate Open office with PHP. I want make mail merge
i have question about two different Bundle object in below methods : onSaveInstanceState(Bundle outState);
I have question about pointers in C. Each pointer has 4 bytes in memory
i have a question about EF4 again :) sorry i can't find any thing
I have a newbie question about EF4. Let's say I have in my EDMX
I have question about python and sqlite3. I want to drop a table from
I have question about managing transaction in asp.net application. For example i have application
I have question about normalization. Suppose I have an applications dealing with songs. First

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.