London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Right, so I have figured out some solution. I hope it is the right way, because I have no idea how all of this works. Documentation is out of date.
public class Patcher
{
public static string[] oldNames = new string[2]{ "oldProperty1", "oldPropert2"};
public static void Patch()
{
using ( var store = DynamicDataStoreFactory.Instance.GetStore( typeof ( ConfigDataModel ) ) )
{
var item = store?.StoreDefinition.AllMappings.FirstOrDefault ( x => oldNames.Contains(x.PropertyName) );
if (item == null)
return;
store.StoreDefinition.Remap ( typeof ( ConfigDataModel ) );
store.StoreDefinition.CommitChanges ();
}
}
}
I think that nested type is not flaged to be mapped, only the top type is. So I needed to call Remap manually in one of my services implementing [InitializableModule].
Hi!
I have a model within a model wich is working fine until I delete public property from the nested model. This generates server error when saving it to the store.
Shouldn't the class attribute handle cases like that?
Is there a way of manually mapping a nested model like that?
The nested model:
And the saving:
And it all works great, but when I delete property from the nested model(ConfigDataModel), then Episerver does not know what to do at Save() and throws this error: