Try our conversational search powered by Generative AI!

Items not persisting in Dynamic Datastore



I am adding objects to a DDS, and I get a new Identity returned when doing so, indicating it was added. 
However, when I've completed adding my items, and go to get a count of items in hte store, it is always returning "0" results:

My code is as follows:


            if (DynamicDataStoreFactory.Instance.GetStore(language) == null)
                DynamicDataStoreFactory.Instance.CreateStore(language, typeof(ExportPageSimple));

            foreach (var page in pagesSimple)
                if (DynamicDataStoreFactory.Instance.GetStore(language).LoadAll<ExportPageSimple>().Any(i => i.PageGuid == page.PageGuid))

                var id = DynamicDataStoreFactory.Instance.GetStore(language).Save(page);

            var itemCount = DynamicDataStoreFactory.Instance.GetStore(language).LoadAll().Count();


The language string is not null, same for the page object being saved. The itemCount int is always 0, dispite the .Save being hit several times. 

Any ideas?

Nov 21, 2013 11:55

Try with:

var store = typeof(language).GetStore();
var items = store.Items<language>();

var count = items.Count();


Nov 21, 2013 12:34

Thanks for the response Frederik,

I needed to have separate Data stores for different languages, as the Ids of the items I was adding were based on page Id's and hence the same..

I've changed my code now to store a single object, which it self has child elements with the language specified

I am able to retrieve the object, update it, and re save it with out issue.


Nov 21, 2013 14:37
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.