This project is read-only.

How to configure parent and abstract classes

Apr 5, 2011 at 5:45 PM

I am struggling to configure the following model.

 

    public class Offer
    {
        public decimal Salary { get; set; }
        public Candidate Candidate { get; set; }
    }

    public abstract class Candidate
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public Offer Offer { get; set; }
    }

    public class InternalCandidate : Candidate
    {
        public string UserName { get; set; }
    }

 

I've got as far as follows but can't figure out how to map the Candidate property back to it's parent.

            var factory = AutoPocoContainer.Configure(x =>
            {
                x.Conventions(c =>
                {
                    c.UseDefaultConventions();
                });
                x.AddFromAssemblyContainingType<InternalCandidate>();
                x.Include<InternalCandidate>()
                    .Setup(c => c.FirstName).Use<FirstNameSource>()
                    .Setup(c => c.LastName).Use<LastNameSource>();
                x.Include<Offer>()
                    .Setup(c => c.Candidate). //what do I do here?
            });
Can anyone help?

May 17, 2011 at 6:36 PM

Did you ever get or figure out a solution for this issue?  I am facing the same dilemma.

 

Thanks