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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:25:32+00:00 2026-05-11T16:25:32+00:00

Okay, I’ll be straight with you guys: I’m not sure exactly how Domain Driven

  • 0

Okay, I’ll be straight with you guys: I’m not sure exactly how Domain Driven my Design is, but I did start by building Model objects and ignoring the persistence layer altogether. Now I’m having difficulty deciding the best way to build my tables in SQL Server to match the models.

I’m building a web application in ASP.NET MVC, although I don’t think the platform matters that much. I have the following object model hierarchy:

Property - has properties such as Address and Postcode

 which have one or more

Case - inherits from PropertyObject
Quote - inherits from PropertyObject

 which have one or more 

Message - simple class that has properties Reference, Text and SentDate

Case and Quote have a lot of similar properties, so I also have a PropertyObject abstract base class that they inherit from. So Property has an Items property of type List which can contain both Case and Quote objects.

So essentially, I can have a Property that has a few Quotes and Cases and a load of Messages that can belong to either of those.

A PropertyObject has a Reference property (and therefore so do Quote and Case) so any Message object can be related back to a Quote OR Case by it’s Reference property.

I’m thinking of using the Entity Framework to get my Models in and out of the database.

My initial thoughts were to have four tables: Property, Case, Quote and Message.

They’d all have their own sequential IDs, and the Case and Quote would be related back to Property by a PropertyID field.

The only way I can think of to relate a Message table back to the Case and Quote tables is to have both a RelationID and RelationType field, but there’s no obvious way to tell SQL server how that relationship works, so I won’t have any referential integrity.

Any ideas, suggestions, help?

Thanks,
Anthony

  • 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-11T16:25:33+00:00Added an answer on May 11, 2026 at 4:25 pm

    I am assuming Property doesn’t also inherit from PropertyObject.

    Given that these tables, Property, Case, Quote and Message, leads to a Table per Concrete Class or TPC inheritance strategy, which I generally don’t recommend.

    My recommendation is that you use either:

    • Table per Hierarchy or TPH – Case and Quote are stored in the same table with one column used as a discriminator, with nullable columns for properties that are not shared.
    • Table per Type or TPT – add a PropertyObject table with the shared fields and Case and Quote tables with just the extra fields for those types

    Both of these strategies will allow you to maintain referential integrity and are supported by most ORMs.

    see this for more: Tip 12 – How to choose an inheritance strategy

    Hope this helps
    Alex

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

Sidebar

Related Questions

Okay i know i have to use the JDBC etc, but im not sure
Okay, so the answer to my question might not be the problem but here's
Okay, so I'm not even sure how to ask this question (much less search
Okay, I am using a custom tab bar (not a tab based app) but
Okay, I kinda asked this question already, but noticed that i might have not
Okay i have this problem with every page i make. im not sure what
Okay, I feel a bit foolish for having to ask this but I guess
Okay, so I have my post.php page. If you are not logged in, you'll
Okay, this is probably a very basic question; but, I'm just getting back in
Okay,I've been following this tutorial http://coenraets.org/blog/android-samples/androidtutorial/ Basically it gives me exactly what i need

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.