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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:22:30+00:00 2026-05-16T22:22:30+00:00

i need to set up a IS-A relationship with coredata. I have a Page

  • 0

i need to set up a IS-A relationship with coredata.

I have a Page class which has the following structure

PROPERTY title
PROPERTY layoutType
RELATIONSHIP layout

Now, i have three classes: ImageLayout, TextLayout, and SlideshowLayout.
I want the Page.layout relationship to refer to one of these three classes depending on the layoutType property.

How can i do with coredata?
Or there is another way to do this? Keep in mind that the number of layouts can grow in the future, so i can’t simply put all the properties in page and leave empty the ones that are not related to the layout of the page.

Thank you in advance!

  • 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-16T22:22:31+00:00Added an answer on May 16, 2026 at 10:22 pm

    You use entity inheritance. You create a parent entity that can be abstract or concrete. Then you assign the parent to the Page.layout relationship. When you need different finds of layouts, you create subentities (like a subclass) of the parent. The object graph will accept any subentities in the relationship.

    E.g. Create an abstract entity called layout. It may have no attributes save the relationship like so (pseudocode):

    Page{
        //...various attributes
        layout<-->Layout.page
    }
    
    Layout{
        page<-->Page.Layout
    }
    
    ImageLayout:Layout{
        imageName:string
    }
    
    TextLayout:Layout{
        text:string
    }
    
    SlideshowLayout:Layout{
        numberOfSlides:int
    }
    

    You can assign any single instance of ImageLayout, TextLayout or SlideshowLayout to the Page.layout relationship of any Page instance.

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

Sidebar

Related Questions

I have a book entity which has a OneToMany relationship set up to Document
I have a object structure like this: public class Entity { IList<Relationship> Relationships{get;set;} }
Need to set up an Entity Person that has a to-many relationship to itself
I have the following many-to-many relationship set up in my db. Mapped using Code-First
I have a simple has_many through relationship set up: class Tag < ActiveRecord::Base has_many
I have a parent object which has a one to many relationship with an
I need Set collection, where its items will be identified by items class. Something
I have a basic has_many through relationship: class Foo < ActiveRecord::Base has_many :bars, :dependent
I have a simple has many relationship between 2 entities in Core Data: Team
I have a set of four POCO objects that need to reference themselves 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.