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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:35:23+00:00 2026-06-09T10:35:23+00:00

We currently have several underlying database tables such as Events , Shop Products ,

  • 0

We currently have several underlying database tables such as Events, Shop Products, Content Pages etc. each with have shared properties such as having a Name, a details page on the front end of the site, a thumbnail url, an active flag etc.

I’m trying to figure out the most efficient way of creating a class of shared properties that can be used to pass around these objects generically. An example might be the search results page. The search can be done against the name of the collection of data which is actually across multiple tables originally.

I am struggling using inheritance due to all these classes originating from LINQ classes and I don’t want to start editing the datacontext designer to suit my needs.

Currently each partial class on my LINQ classes contains a SharedObject method:

    public partial class Event
    {
        public SharedObject SharedObject
        {
           get
           {
            return new SharedObject(this);
           }
        }
     ...

This is repeated for Events, Shop Products etc. The Shared Object class contains the following:

public class SharedObject
{
public string Reference { get; set; }
public string Name { get; set; }
public string ImageURL { get; set; }
public bool IsVisible { get; set; }
public bool IsAdminVisible { get; set; }
public string FrontEndDetailsURL { get; set; }
public string AdminDetailsURL { get; set; }
public object OriginalObject { get; set; }
public string ObjectDescription { get; set; }

public SharedObject(object originalObject)
{
    if (originalObject.GetType() == typeof(Event))
    {
        Event eventx = (Event)originalObject;

        Reference = eventx.Reference;
        Name = eventx.Name;
        ImageURL = eventx.ImageURL;
        IsVisible = eventx.IsActive && !Event.IsArchived;
        IsAdminVisible = !eventx.IsArchived;
        FrontEndDetailsURL = eventx.DetailsURL;
        AdminDetailsURL = eventx.AdminDetailsURL;
        OriginalObject = originalObject;
        ObjectDescription = "Event";
    }
    ....

Does this sound like a suitable solution?

  • 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-09T10:35:25+00:00Added an answer on June 9, 2026 at 10:35 am

    Consider using an interface. This is much more flexible.

    public interface ISharedObject
    {
       string Reference { get; set; }
       string Name { get; set; }
       string ImageURL { get; set; }
       bool IsVisible { get; set; }
       bool IsAdminVisible { get; set; }
       string FrontEndDetailsURL { get; set; }
       string AdminDetailsURL { get; set; }
       object OriginalObject { get; set; }
       string ObjectDescription { get; set; }
    }
    
    public partial class Event : ISharedObject
    {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have several action buttons in different pages, and each button performs some
I currently have several audit tables that audit specific tables data. e.g. ATAB_AUDIT, BTAB_AUDIT
I currently have several websites which live on separate domains: www.app1.com www.app2.com www.app3.com Each
Currently I have several classes, each of which deals with different sites. They act
We have several product lines built around a common core and currently maintain them
I currently have a Table [org.eclipse.swt.widgets.Table] with several TableColumns; however, due to UI space
I currently have a website where I'm hosting a webservice with several web methods,
Here is the thing. I currently have a tabBar controller, with several navigation controllers
I have developed several general purpose script functions, for Google Spreadsheet apps. Currently I
I have a class that currently has several methods that take integer parameters. These

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.