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

  • SEARCH
  • Home
  • 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 8479675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:05:54+00:00 2026-06-10T19:05:54+00:00

I’m currently going to begin a new project to help with Complaints. I have

  • 0

I’m currently going to begin a new project to help with Complaints. I have worked out all the fields etc.. but in doing so, I’ve realised I need more than 1 type of Complaint. They are Customer Complaint, Supplier Complaint or Defect Complaint. They share many of the same fields but differ slightly, so I’m not sure how I would design this in a SQL Server database and/or using EF. The application will be an ASP.NET MVC 4 application using C#, so I could take advantage of Code First but as I said, I’m not sure how I’d design these Entities:

All 3 complaint types share the following columns:

ComplaintType (int), Department (int), 
Code (int), DefectReference (string), Cause (int)

Customer complaint and supplier complaint share these columns:

ComplaintText (string), Orders (collection), Rectification (string)

Here are columns unique to customer complaint:

AccountNumber (string), CustomerName (string)

And finally, here are fields unique to Supplier Complaint:

SupplierNumber (string), SupplierName (string)

So my questions are:

  1. How would I approach this creating my Models to use with EF Code First or
  2. How would I design this using SQL Server?

Thanks

Note: There are more columns (ID’s etc..) but I’ve shortened it for this example.

  • 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-06-10T19:05:56+00:00Added an answer on June 10, 2026 at 7:05 pm

    There are a few ways to go about implementing inheritance in Code First, and it all depends on how you want the tables represented in SQL.

    Do you want a single complaint table for all types, where some fields are left null based on what type it is? You’d use Table Per Hierarchy for that.

    Do you want a main complaint table that house the common fields, and then relational tables which hold the extra columns, based on class? You’d use Table per Type for that.

    If you want a single table per complaint type, with the common fields expressed in every table? That’s Table per Concrete Type

    Personally, with what you have I’d probably lean towards Table Per Type. Here’s a shortened example:

    public abstract class Complaint 
    {
        public int ComplaintType { get; set; }
        public int Department { get; set; }
        public int Code  { get; set; }
    }
    
    [Table("CustomerComplaint")]
    public class BankAccount : Complaint
    {
        public string ComplaintText { get; set; }
        public string Rectification { get; set; }
    }
    
    [Table("SupplierComplaint")]
    public class SupplierComplaint: Complaint
    {
        public string SupplierNumber { get; set; }
        public string SupplierName { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't

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.