mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Changed Loader and Setter delegates of the LazyFields of LocalizationPart to (#8693)
use Store/Retrieve implementations rather than go directly to the Record.
This commit is contained in:
parent
610b3c4f53
commit
e55dbb0db8
@ -31,22 +31,26 @@ namespace Orchard.Localization.Handlers {
|
|||||||
|
|
||||||
protected static void PropertySetHandlers(ActivatedContentContext context, LocalizationPart localizationPart) {
|
protected static void PropertySetHandlers(ActivatedContentContext context, LocalizationPart localizationPart) {
|
||||||
localizationPart.CultureField.Setter(cultureRecord => {
|
localizationPart.CultureField.Setter(cultureRecord => {
|
||||||
localizationPart.Record.CultureId = cultureRecord.Id;
|
localizationPart.Store<LocalizationPart, LocalizationPartRecord, int>(r => r.CultureId,
|
||||||
|
cultureRecord != null ? cultureRecord.Id : 0);
|
||||||
return cultureRecord;
|
return cultureRecord;
|
||||||
});
|
});
|
||||||
|
|
||||||
localizationPart.MasterContentItemField.Setter(masterContentItem => {
|
localizationPart.MasterContentItemField.Setter(masterContentItem => {
|
||||||
localizationPart.Record.MasterContentItemId = masterContentItem.ContentItem.Id;
|
localizationPart.Store<LocalizationPart, LocalizationPartRecord, int>(r => r.MasterContentItemId,
|
||||||
|
masterContentItem.ContentItem.Id);
|
||||||
return masterContentItem;
|
return masterContentItem;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void LazyLoadHandlers(LocalizationPart localizationPart) {
|
protected void LazyLoadHandlers(LocalizationPart localizationPart) {
|
||||||
localizationPart.CultureField.Loader(() =>
|
localizationPart.CultureField.Loader(() =>
|
||||||
_cultureManager.GetCultureById(localizationPart.Record.CultureId));
|
_cultureManager.GetCultureById(
|
||||||
|
localizationPart.Retrieve<LocalizationPart, LocalizationPartRecord, int>(r => r.CultureId)));
|
||||||
|
|
||||||
localizationPart.MasterContentItemField.Loader(() =>
|
localizationPart.MasterContentItemField.Loader(() =>
|
||||||
_contentManager.Get(localizationPart.Record.MasterContentItemId, VersionOptions.AllVersions));
|
_contentManager.Get(
|
||||||
|
localizationPart.Retrieve<LocalizationPart, LocalizationPartRecord, int>(r => r.MasterContentItemId), VersionOptions.AllVersions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user