How to retrieve the type for certain entity id

Aug 12, 2016 at 1:59 PM
Hello,
When using BrightstarDB each entity has its unique id over the database.
Let's say I have an entity of type Article with the id 210d0d37-ff74-4df1-883a-fee0c962c042
and with the URI mydomain.com/individual/210d0d37-ff74-4df1-883a-fee0c962c042
is there any function such this:
string type = GetTypeForId(string Id)
that can return the given type for the given id.
Thank you!
Marked as answer by Wisamx on 9/4/2016 at 4:30 PM
Coordinator
Aug 16, 2016 at 8:27 AM
Hi,

Sorry for the late reply!

There isn't any function like that in our Entity Framework API at the moment. You could use the Data Objects API instead. It would be something like:
// Assume that doContext is a DataObjectContext that connects to your store
var item = doContext.GetDataObject("http://mydomain.com/individual/210d0d37-ff74-4df1-883a-fee0c962c042");
return item.GetTypes();
Note that an item can potentially have multiple types. Most of the time it will only be one, but if you use some of the more advanced features of the Entity Framework it is possible to have items with multiple types assigned.

I guess that this is something we could surface through the EntityFramework somehow. I wonder though if it would be better to provide the types as a list of the EF interfaces that the object supports rather than a list of the type URIs.

Cheers

Kal
Marked as answer by Wisamx on 9/4/2016 at 4:30 PM
Sep 4, 2016 at 11:29 PM
Thank you so much techquila 😃
I appreciate your help and your response everytime ❤