コード例 #1
0
        /// <summary>
        /// Validates the cardinalities of the properties of this <see cref="MappingToReferenceScale"/>.
        /// </summary>
        /// <returns>
        /// A list of potential errors.
        /// </returns>
        protected override IEnumerable <string> ValidatePocoCardinality()
        {
            var errorList = new List <string>(base.ValidatePocoCardinality());

            if (this.DependentScaleValue == null || this.DependentScaleValue.Iid == Guid.Empty)
            {
                errorList.Add("The property DependentScaleValue is null.");
                this.DependentScaleValue = SentinelThingProvider.GetSentinel <ScaleValueDefinition>();
                this.sentinelResetMap["DependentScaleValue"] = () => this.DependentScaleValue = null;
            }

            if (this.ReferenceScaleValue == null || this.ReferenceScaleValue.Iid == Guid.Empty)
            {
                errorList.Add("The property ReferenceScaleValue is null.");
                this.ReferenceScaleValue = SentinelThingProvider.GetSentinel <ScaleValueDefinition>();
                this.sentinelResetMap["ReferenceScaleValue"] = () => this.ReferenceScaleValue = null;
            }

            return(errorList);
        }
コード例 #2
0
        /// <summary>
        /// Resolve the properties of the current <see cref="MappingToReferenceScale"/> from its <see cref="DTO.Thing"/> counter-part
        /// </summary>
        /// <param name="dtoThing">The source <see cref="DTO.Thing"/></param>
        internal override void ResolveProperties(DTO.Thing dtoThing)
        {
            if (dtoThing == null)
            {
                throw new ArgumentNullException("dtoThing");
            }

            var dto = dtoThing as DTO.MappingToReferenceScale;

            if (dto == null)
            {
                throw new InvalidOperationException(string.Format("The DTO type {0} does not match the type of the current MappingToReferenceScale POCO.", dtoThing.GetType()));
            }

            this.DependentScaleValue = this.Cache.Get <ScaleValueDefinition>(dto.DependentScaleValue, dto.IterationContainerId) ?? SentinelThingProvider.GetSentinel <ScaleValueDefinition>();
            this.ExcludedDomain.ResolveList(dto.ExcludedDomain, dto.IterationContainerId, this.Cache);
            this.ExcludedPerson.ResolveList(dto.ExcludedPerson, dto.IterationContainerId, this.Cache);
            this.ModifiedOn          = dto.ModifiedOn;
            this.ReferenceScaleValue = this.Cache.Get <ScaleValueDefinition>(dto.ReferenceScaleValue, dto.IterationContainerId) ?? SentinelThingProvider.GetSentinel <ScaleValueDefinition>();
            this.RevisionNumber      = dto.RevisionNumber;
            this.ThingPreference     = dto.ThingPreference;

            this.ResolveExtraProperties();
        }