private ODataUri GenerateEntityIdUri(EntitySet entitySet, EntityType entityType, IEnumerable <NamedValue> keyValues)
        {
            ExceptionUtilities.CheckAllRequiredDependencies(this);

            // null checks performed by ODataUriBuilder
            var conventionalId = new ODataUri();

            conventionalId.Segments.Add(new ServiceRootSegment(this.Service.ServiceUri));
            conventionalId.Segments.Add(ODataUriBuilder.EntitySet(entitySet));
            conventionalId.Segments.Add(ODataUriBuilder.Key(entityType, keyValues));
            return(conventionalId);
        }
Exemplo n.º 2
0
        private static ODataUri GetTopLevelUri(QueryStructuralValue entity)
        {
            ExceptionUtilities.CheckArgumentNotNull(entity, "entity");
            QueryEntityType entityType = entity.Type as QueryEntityType;

            ExceptionUtilities.CheckObjectNotNull(entityType, "Given structural value was not an entity type");

            var setSegment = ODataUriBuilder.EntitySet(entityType.EntitySet);
            var keyValues  = entityType.EntityType.AllKeyProperties.Select(k => new NamedValue(k.Name, entity.GetScalarValue(k.Name).Value));
            var keySegment = ODataUriBuilder.Key(entityType.EntityType, keyValues);

            return(new ODataUri(setSegment, keySegment));
        }