Closed vigouredelaruse closed 1 year ago
Hello @vigouredelaruse
In the current version of the library, the way to access the entity metadata is by using the annots
object.
In the example you mention.
//Tenant(ebc3f5cb-65df-4537-8279-08da9757ccd6)?$expand=AccessControlEntries($top=4;$skip=0;$count=true)
let tenantEntity = this.tenantsService.entity('ebc3f5cb-65df-4537-8279-08da9757ccd6');
tenantEntity.query((q) => {
q.expand({AccessControlEntries: {top: 4, skip: 0, count: true}});
})
tenantEntity.fetch().subscribe(({entity, annots}) => console.log(annots.property("AccessControlEntries")));
The property
function in the example returns a Map
with the values you seek
...
buuuut
Motivated by your question, I think it's time to improve this, for a future version of the library.
I'm thinking of adding type to the annotations and making the return values of property
consistent with the basis of what the annotations and metadata associated with the entity imply.
The intention of this change is to return a similar structure that gives information about the metadata of the properties, whether they are collections or simple.
I think it would be an interesting addition for the next version of the library (0.110.0)
One more comment about metadata and annotations. It is interesting to try the metadata
configuration value to full
to get as much metadata as possible from the backend.
demo
Regards
thanks for looking into it
not to hijack the question but while on the subject of feature usage/request/buildout: re entity relationship creation (por practicar, cómo cambiar las relaciones entre entidades)
what is, and where are any examples of the library's support for http methods patch, post and put, with the associated odata semantics pertaining to mutating entity relationships
as per the aspnet odata docs here claim the following
A reference has its own URI, with the form /Entity/NavigationProperty/$ref.
For example, here is the URI to address the reference between a product and its supplier:
http:/host/Products(1)/Supplier/$ref
To add a relationship, the client sends a POST or PUT request to this address.
PUT if the navigation property is a single entity, such as Product.Supplier.
POST if the navigation property is a collection, such as Supplier.Products.
the payload is supposed to look like this
PUT http://myproductservice.example.com/Products(6)/Supplier/$ref HTTP/1.1
OData-Version: 4.0;NetFx
OData-MaxVersion: 4.0;NetFx
Accept: application/json;odata.metadata=minimal
Accept-Charset: UTF-8
Content-Type: application/json;odata.metadata=minimal
User-Agent: Microsoft ADO.NET Data Services
Host: myproductservice.example.com
Content-Length: 70
Expect: 100-continue
{"@odata.id":"http://myproductservice.example.com/Suppliers(4)"}
photoOfScott.reference().set(photo).subscribe(console.log); // Set is a shortcut for .put()
thanks again
given a json snippit like below that expands and counts a navigation property, created with a query like so
if this were a $query against the root entityset the library lets you get the count from annots
but how do you get nested counts of navigation properties?, as in this case
as well and related, how does one access the raw json reply?
thanks