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 7593699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:14:04+00:00 2026-05-30T21:14:04+00:00

The way I usually create my applications is by creating the database first and

  • 0

The way I usually create my applications is by creating the database first and using LINQ to SQL to create the classes for me.
But in my current project I want to try and use inheritance, and I don’t think it’s possible creating inheritance in a database?

Thus I’m wondering how I would create an inheriting class with SQL Server / LINQ, so I can save / get data from my database.
For example if I have
The parent:

- contact (id, name, telephone number, address, email..) 

And the children:

- customer(id, title, activity, discount, vat...)
- supplier (id, title, activity, vat, bankaccount_number, manager, expiration_day...)
- driver (id, first name, hire_date, fire_date, function, date of birth...)

How would I create a working database connection for these classes?
I don’t have a lot of experience with creating classes as I usually let Visual Studio (LINQ) create them for me.

I’d greatly appreciate any help,
Thanks 🙂

  • 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-30T21:14:06+00:00Added an answer on May 30, 2026 at 9:14 pm

    Linq-to-Entities (Entity Framework) provides this functionality out of the box.

    You can design your entities as being derivations of a parent class, and then create queries for them like so:

    var customers = context.ContactSet.OfType<Customer>();
    var suppliers = context.ContacctSet.OfType<Supplier>();
    var drivers = context.ContactSet.OfType<Driver>();
    

    The parent class and children classes share an entity key. The database should have a (1:0 or 1) relationship between the parent table and child tables.

    I don’t think anything similar exists for Linq-to-SQL.

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

Sidebar

Related Questions

Typical way of creating a CSV string (pseudocode): Create a CSV container object (like
We use resx files to localize our web applications. We usually create local resx
I have a Microsoft Access 2010 database(*). Now, using Visual Studio 2010, I want
I usually use the Ruby on Rails framework but for this project I need
When I run an MSI (without parameters) I usually have to click my way
Why should I use #' together with lambda? It is usually written that way,
Which way do you prefer to create your forms in MVC? <% Html.Form() {
Whichever way I do it, it seems something goes wrong when using the conditional
I've been using rails, merb, django and asp.net mvc applications in the past. What
Using the code generated by restful_authentication, we usually get 'localhost' as the URL in

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.