I am upgrading code from one of our plugins to AC9 and there are a lot of configuration settings stored in the ac_storesettings table.
One of them, at least, is not getting saved correctly.
The view code is
@Html.DropDownListFor(model => model.MomVersionId, new SelectList(
new[]
{
new { Value = "1", Text="Standard(DBF)"},
new { Value = "2", Text="MomXL(Sql)"},
},
"Value",
"Text",
Model.MomVersionId), new { @class = "form-control", style = "width:300px;" })
The controller picks up the selected value of 1 OK
options.MomVersion = ((MOMVersion)AlwaysConvert.ToByte(configModel.MomVersionId)); --value is XBase
Then there is a an options.Save() method that uses
StoreSettingsManager settings = AbleContext.Current.Store.Settings;
settings.SetValueByKey("W2M_MOMInventory_MomVersion", _MomVersionId.ToString());
I save using this code, which I picked up elsewhere in AC:
Store store = AbleContext.Current.Store;
store.Settings.Save();
IStoreRepository _storeRepo = AbleContext.Resolve<IStoreRepository>();
_storeRepo.Save(store);
The value of _MOMVersionId here is 1, which is correct. But it gets saved as 0. When I step through the code, the settings show all the AC store settings, then there is a _settingMap, which shows a value of 0. See image. How can I fix this?
Thanks
2021-09-09_12-49-01.png
(14kb) downloaded 0 time(s).