Hi,
I am trying to read Data from Dynamic Data Store using below code
using (var store = typeof(DataStorage.SenderInfo).GetOrCreateStore()){var selectSingle = customerCodes.Count == 1;store.Refresh();var data = store.Items<DataStorage.SenderInfo>().ToList().Where(x => (selectSingle && customerCodes.Contains(x.CompanyCode)) ||x.IsGlobalSender).OrderBy(x => x.CompanyName).ThenBy(x => x.Name).ToList();
var senders = data.Select(MapToSenderInfoEntity).ToList();return senders;}
[EPiServerDataStore(AutomaticallyRemapStore = true, AutomaticallyCreateStore = true)]internal class SenderInfo : IDynamicData{public Identity Id { get; set; }public string Name { get; set; }public string Initials { get; set; }public string ImageUrl { get; set; }public string CompanyCode { get; set; }public int ContentId { get; set; }public string CompanyName { get; set; }public bool IsGlobalSender { get; set; }}
However, the result of the above snippet is not Consistent sometime I am able to get data and sometimes null
Not sure what's wrong
Any Suggestions?
Hi,
I am trying to read Data from Dynamic Data Store using below code
using (var store = typeof(DataStorage.SenderInfo).GetOrCreateStore())
{
var selectSingle = customerCodes.Count == 1;
store.Refresh();
var data = store.Items<DataStorage.SenderInfo>().ToList()
.Where(x => (selectSingle && customerCodes.Contains(x.CompanyCode)) ||
x.IsGlobalSender)
.OrderBy(x => x.CompanyName)
.ThenBy(x => x.Name)
.ToList();
var senders = data.Select(MapToSenderInfoEntity).ToList();
return senders;
}
[EPiServerDataStore(AutomaticallyRemapStore = true, AutomaticallyCreateStore = true)]
internal class SenderInfo : IDynamicData
{
public Identity Id { get; set; }
public string Name { get; set; }
public string Initials { get; set; }
public string ImageUrl { get; set; }
public string CompanyCode { get; set; }
public int ContentId { get; set; }
public string CompanyName { get; set; }
public bool IsGlobalSender { get; set; }
}
However, the result of the above snippet is not Consistent sometime I am able to get data and sometimes null
Not sure what's wrong
Any Suggestions?