Avoiding the eager creation of certain proxies to optional records

cannot be done in fluent config
the IsSelectable = false prevents unused ContentPartRecord proxies from being created
for each ContentItemRecord or ContentItemVersionRecord.
done for perf reasons - has no other side-effect

--HG--
branch : perf
This commit is contained in:
Louis DeJardin
2010-12-01 19:37:10 -08:00
parent a4b1f2f36d
commit b88178b542

View File

@@ -86,6 +86,23 @@ namespace Orchard.Data {
_dataServicesProviderFactory
.CreateProvider(parameters)
.BuildConfiguration(parameters));
#region NH-2.1.2 specific optimization
// cannot be done in fluent config
// the IsSelectable = false prevents unused ContentPartRecord proxies from being created
// for each ContentItemRecord or ContentItemVersionRecord.
// done for perf reasons - has no other side-effect
foreach (var persistentClass in config.ClassMappings) {
if (persistentClass.EntityName.StartsWith("Orchard.ContentManagement.Records.")) {
foreach (var property in persistentClass.PropertyIterator) {
if (property.Name.EndsWith("Record") && !property.IsBasicPropertyAccessor) {
property.IsSelectable = false;
}
}
}
}
#endregion
return config;
}