Dynamically creating Properties from a Dictionary

22 views
Skip to first unread message

Robert Tilson

unread,
Oct 28, 2014, 4:50:29 AM10/28/14
to brightsta...@googlegroups.com
Hi,

I have a data set which returns some header information and then a list of attributes in a Dictionary. The attributes are largely optional and will vary for each object, some of which need to searched on.

Based on the above it would appear a NoSQL solution would work best. My question is how I would I best implement this using Brightstar DB.

Ideally it would be nice to use EF for the concrete properties and then extend that view, to store the additional information, utilising the Data Objects/Dynamic API. It there an example of this anywhere?

Really interesting project, and the fact you can embed the Database is a really useful.

Thanks

Rob

Khalil Ahmed

unread,
Oct 28, 2014, 5:08:26 AM10/28/14
to brightsta...@googlegroups.com
Hi Rob,

Thanks for the email - just to let you know, the discussion forum has moved over to Codeplex for administrative reasons that I won't bore you with :)

You use case sounds interesting and I think we can support it to some extent, though you will be on the "bleeding edge". The EF builds on top of the Data Objects API and you can construct a EF context by passing a DO store in to the constructor. What this means in effect is that you can have handles to both contexts in your code and use them interchangeably depending on what you want to do. There would be some caveats:

1) EF caches property values for entities, so I suspect that if you try to directly manipulate properties that are mapped to the entity at the data object level you will run into problems.

2) You will need to either manage the mapping between the entity ID and the full URI yourself or you will need to cast an entity instance to BrightstarEntityObject and access its Identity property (which will give you the full URI identifier for the entity).

3) Both contexts map down onto a common transaction so when saving changes you should always do it by calling the SaveChanges on the entity context.

4) You may need to play around with the construction order, but I'm pretty sure that it would be best to construct the entity and then retrieve its data object rather than the other way around.

I'd be really interested to hear how you get on with this and if you have thoughts on how we can maybe better support this sort of use case please let me know - I think its the kind of thing that would really help the flexibility of the RDF model to shine through. The CodePlex discussion forum is at https://brightstardb.codeplex.com/discussions

Cheers

Kal



--
You received this message because you are subscribed to the Google Groups "BrightstarDB Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brightstardb-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Tilson

unread,
Oct 28, 2014, 9:14:36 AM10/28/14
to brightsta...@googlegroups.com
Hi Kal,

Thanks for your prompt reply. I'll do some further investigations based on your response to see If can come up with a solution, but looks possible. 

I also have the option of pulling out of the Dictionary the queryable data and required fields into the EF Data Model, and leaving the remainder as a dictionary. This reduces the flexibility but as they are based on a fixed schema, it may be a simpler approach.

If you have any further examples of a Dynamic API implementaton, in addition to the online docs, that would be helpful to get started.

I'll post any useful findings/snippets to Codeplex

Cheers

Rob
To unsubscribe from this group and stop receiving emails from it, send an email to brightstardb-users+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages