Exemple #1
0
        public BatchReferenceSegment(string contentId, IEdmType edmType, IEdmEntitySet entitySet)
        {
            ExceptionUtils.CheckArgumentNotNull(edmType, "resultingType");
            ExceptionUtils.CheckArgumentNotNull(contentId, "contentId");
            if (!ODataPathParser.ContentIdRegex.IsMatch(contentId))
            {
                throw new ODataException(ODataErrorStrings.BatchReferenceSegment_InvalidContentID(contentId));
            }

            this.edmType   = edmType;
            this.entitySet = entitySet;
            this.contentId = contentId;

            this.Identifier         = this.ContentId;
            this.TargetEdmType      = edmType;
            this.TargetEdmEntitySet = this.EntitySet;
            this.SingleResult       = true;
            this.TargetKind         = RequestTargetKind.Resource;

            if (entitySet != null)
            {
                UriParserErrorHelper.ThrowIfTypesUnrelated(edmType, entitySet.ElementType, "BatchReferenceSegments");
            }
        }