- Where Developers Learn, Share, & Build Careers
I understand that the total roots are the only objects that will be loaded by the client and all the operations total for the objects within the total route The root is done by the same conference, a repository interface should be defined for a root route and any firmness within the aggreate root should be done by "Aggreate Root Repository" corresponding to the total route for any firmness operation. Does this mean that only the only root object in the "Gross Root repository" should be passed for the tasks related to the sub-objects of the total root object gross route?
Let me give an example.
Suppose you have a school object and student object. Since the student can not exist without any school (you can say that a student can leave school, in this case he is no longer a student), then we have
class school {string SchoolName; IList & LT; Students & gt; Students; } Class student {string StudentName; String grade; School miscals; } The school is the total root here. Now suppose we want to define a repository for the operation of perseverance.
Which would be right below?
1)
Interface ISchoolRepository {void AddSchool (school unit); Zero AddStudent (school unit); // Create a school unit by adding only the student (student) as the "student" specialty in school 2)
Interface ISSR Repository {Zero Edschool (school unit); Zero AddStudent (student unit); // Create a Student Unit Student organization refers to the school unit in the "MySchool" specialty. } in 1) We are just highlighting the overall in the interface. Therefore, any DAL implementing the ISSQL repository will have to get the student from the school object to add the student. 2) looks more clearly and I may feel stupid by giving 1) suggestion but the concept of total root in pure theory 1)
Interface ISchoolRepository {void AddSchool (School Unit); Zero AddStudent (Student Unit); // Create a Student Unit Student institution "School of Myschool" specialty or more strictly
interface ISchoolRepository {void AddSchool (school unit); Zero AddStudent (string studentname, string grade); // without highlighting the type of student}
Comments
Post a Comment