This project has moved and is read-only. For the latest updates, please go here.

How to retrieve the type for certain entity id

Aug 12, 2016 at 2:59 PM
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
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
Aug 16, 2016 at 9:27 AM

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("");
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.


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