tailieunhanh - NET Domain-Driven Design with C#P roblem – Design – Solution phần 8

đại diện cho danh sách Người nhận, những người cần được sao chép trên tất cả các thư có để làm với các yêu cầu đề có thể có, nhưng như tôi đã phân tích các lớp Yêu cầu đề xuất trong hình , tôi nhận thấy rằng có rất nhiều các tính chất tương tự như lớp RequestForInformation và đệ trình. | Chapter 8 Change Orders public DateTime DateOfSubstantialCompletion get DateTime completionDate null if completionDate return completionDate This getter starts by setting up a Nullable DateTime variable to use as the return value and sets it to null. The next step is to check whether the currentProject instance s EstimatedCompletionDate property value has a value but before doing that I have to call the GetCurrentProject method to make sure that the currentProject field is properly initialized. If the Project has an EstimatedCompletionDate value I then call the GetPreviousTimeChangedTotal method to get the number of days that have been added to or subtracted from the current Project as of the date of the current Change Order. I then add the value of the PreviousTimeChangedTotal property and the timeChanged class field value to add the right number of days to the Project s EstimatedCompletionDate property and then return that value. The timeChanged field value is set via the TimeChanged property. The Numberspecification Property This property is designed to model the business rules about the proper numbering of Change Orders. The NumberSpecification property is represented by the ChangeOrderNumberSpecification class. Its only job is to validate that the Change Order adheres to the numbering rules which are if you remember that all Change Orders must be numbered consecutively within a Project and that there cannot be duplicate Change Order numbers within a Project. public NumberSpecification ChangeOrder NumberSpecification get return This is very similar to the other Number Specification implementations in the last two chapters so seeing that I felt this needed some more refactoring in order to eliminate the duplicate code. As a .

TỪ KHÓA LIÊN QUAN