0

I need some advice on part of my model I am designing. As you can see in my Rfi entity, I have a collection of BaseImpact types. There will be several types of impacts that can be added to that collection. Each impact type has its own properties. As an example I created a Cost Impact and a Schedule Impact. Now, these are not very different, but you get the idea. I am trying to figure out how I can use this same type of model and then add the mappings / relationships to the database. I'd really like the BaseImpact to be abstract, but I may need it to be in the DB, but I am not usre.

    public class Rfi
        {
            public ICollection<BaseImpact> Impacts { get; set; }
        }

        public class BaseImpact : BaseEntity
        {
            #region Navigation
            public virtual ICollection<Comment> Comments { get; set; }
            #endregion
        }

        public class CostImapct: BaseImpact
        {
            public decimal Cost { get; set; }

        }
        public class ScheduleImpact: BaseImpact
        {
            public int days { get; set; }

        }

1 Answer 1

1

See this series of posts on different options for modeling inheritance hierarchies in EF Code First.

Sign up to request clarification or add additional context in comments.

1 Comment

I had ran accross those posts before and totally didn;t think about that! this is exactly what I was looking for!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.