예제 #1
0
        public Result <SystemRelation, OperationError> AddUsageRelationTo(
            ItSystemUsage toSystemUsage,
            Maybe <ItInterface> relationInterface,
            string description,
            string reference,
            Maybe <RelationFrequencyType> targetFrequency,
            Maybe <ItContract.ItContract> targetContract)
        {
            if (toSystemUsage == null)
            {
                throw new ArgumentNullException(nameof(toSystemUsage));
            }

            var newRelation = new SystemRelation(this);

            var updateRelationResult = UpdateRelation(newRelation, toSystemUsage, description, reference, relationInterface, targetContract, targetFrequency);

            if (updateRelationResult.Failed)
            {
                return(updateRelationResult.Error);
            }

            UsageRelations.Add(newRelation);

            return(newRelation);
        }
예제 #2
0
 private Result <SystemRelation, OperationError> UpdateRelation(
     SystemRelation relation,
     ItSystemUsage toSystemUsage,
     string changedDescription,
     string changedReference,
     Maybe <ItInterface> relationInterface,
     Maybe <ItContract.ItContract> toContract,
     Maybe <RelationFrequencyType> toFrequency)
 {
     return(relation
            .SetRelationTo(toSystemUsage)
            .Bind(_ => _.SetDescription(changedDescription))
            .Bind(_ => _.SetRelationInterface(relationInterface))
            .Bind(_ => _.SetContract(toContract))
            .Bind(_ => _.SetFrequency(toFrequency))
            .Bind(_ => _.SetReference(changedReference)));
 }