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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:03:08+00:00 2026-05-29T05:03:08+00:00

What is best way to map following classes? I have classes where communication is

  • 0

What is best way to map following classes?

I have classes where communication is “base” class as it contains shared data for either option. There can be only communication to ComSms or to ComEmail. The problem is i am unsure how to proceed with the mapping.
I would like if at all possible use one repository for accessing the Objects.

Class Set Up

public interface ICommunication
    {

    }

public Communication: ICommunication{
   //PK and FK on this item
   public virtual int CommunicationId{get;set;}  
   public virtual string Name {get;set;}
   public virtual string Surname {get;set;}
   public virtual DateTime Date{get;set;}

   //I am expecting to switch on type between ComSms and ComEmail
   public virtual Type {get;set;}     

}

public ComSms : Communication{
   public virtual string Number {get;set;}
   public virtual string Text {get;set;}
}
public ComEmail : Communication{
   public virtual string Subject{get;set;}
   public virtual string Body {get;set;}
   public virtual string Address {get;set;}
}

Database

Simplified Database layout

Imagined usage

ICommunication smsToSave = new ComSms()
smsToSave.Name = "UserName";
smsToSave.Surname ="UserSurname";
smsToSave.Date = DateTime.Now;
smsToSave.Type = 1;
smsToSave.Number ="123456789";
smsToSave.Text = "Hello boys";
CommunicationRepository.Save(smsToSave)
  • 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-29T05:03:11+00:00Added an answer on May 29, 2026 at 5:03 am

    ok
    i have resolved it by separated repositories that handles ever part of it instead

    i could not bind it correctly, so chosen to go around the problem.
    if you find any way of doing this please let me know

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

Sidebar

Related Questions

Lets say I want to map the following two classes: public class A {
I have a class hierarchy with the following three classes: template<int pdim > class
I'm wondering what the best way of solving the following problem is: I have
What is the best way to model the following... Assume I have two objects:
What's the best way to return a Java Map using the JSON format? My
The best way of describing this is I have a table of people with
What would be the best way to accomplish something like this? Suppose I have
What's the best way to represent graph data structures in LabVIEW? I'm doing some
I have a HashMap of a following structure: HashMap<Integer, int[]> map = new HashMap<Integer,
We have the following data model: CalendarAppointment 1 <------> * AppointmentRole * <--------> 1

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.