objective c - How to model core-data relationship, one-to-one or one-to-many? -


I have a client object and a loan object. It is a one-to-many relationship (customer & lt; - >> loan ). To look at customer's selection and payment projection, there are 5 types of peeph plans in each loan (not exactly 5 and will not change in the next 100 years). Each payment plan includes types, initial payments, monthly payments, interest, number-installments, total payments, total-interest, and pay-off dates. What is the best way to model payoff object?

Option 1:

There are five relationships for the payoff object representing each five different payment plan of the loan. That is, within the loan object, 5 relationship payment plans, payoffphoneb, payoff pln, payoff plnd, payoff plania is for the piege object.

Option 2:

There are several relationships between each debt; Loans and Lieutenant; - >> Payoff). To obtain a special payoff plan, the app will check the list of payoff items for the type of payment object, for example, to display the contents of the payoff plan c, the app list the payoff items for the loan To find out if the typing plan is C, retrieve the details.

What are the other options? Thank you

This is not a sound for me, such as cafe plans are actually data they look like the amount of logic Which will work on the data provided by customer and loan objects. In other words, the argument of each of the five plan types is normal and only the data provided is produced in different outputs.

If so, you probably do not need core data entities, which represent payoff plans, instead you should create general, i.e. non-managed objects that accept methods that Accept a customer and loan as input. If necessary, you can attach them to unmanaged properties (which do not appear in the entity) for customer and loan classes.

If the actual data in the Peaf Plan Object graph is unique and the choice is best (2)


Comments