mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Orchard.Data {
|
||||||
|
/// <summary>
|
||||||
|
/// Marks whether a class should be mapped as an NHibernate record
|
||||||
|
/// </summary>
|
||||||
|
public class MapAsRecordAttribute : Attribute {
|
||||||
|
private readonly bool _enabled;
|
||||||
|
|
||||||
|
public MapAsRecordAttribute() : this(true) { }
|
||||||
|
|
||||||
|
public MapAsRecordAttribute(bool enabled) {
|
||||||
|
_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Enabled => _enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ using System.Web.Mvc;
|
|||||||
using Autofac.Core;
|
using Autofac.Core;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Records;
|
using Orchard.ContentManagement.Records;
|
||||||
|
using Orchard.Data;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
@@ -96,7 +97,7 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var feature = availableFeatures[shellFeature];
|
var feature = availableFeatures[shellFeature];
|
||||||
|
|
||||||
foreach (var childDependency in ExpandDependenciesInternal(availableFeatures, feature.Dependencies, dependentFeatureDescriptor: feature))
|
foreach (var childDependency in ExpandDependenciesInternal(availableFeatures, feature.Dependencies, dependentFeatureDescriptor: feature))
|
||||||
yield return childDependency;
|
yield return childDependency;
|
||||||
|
|
||||||
@@ -197,7 +198,12 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsRecord(Type type) {
|
private static bool IsRecord(Type type) {
|
||||||
return ((type.Namespace ?? "").EndsWith(".Models") || (type.Namespace ?? "").EndsWith(".Records")) &&
|
var mapAsRecordAttr = type.GetCustomAttributes(typeof(MapAsRecordAttribute), false)
|
||||||
|
.OfType<MapAsRecordAttribute>()
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
return ((type.Namespace ?? "").EndsWith(".Models") || (type.Namespace ?? "").EndsWith(".Records") || mapAsRecordAttr?.Enabled == true) &&
|
||||||
|
mapAsRecordAttr?.Enabled != false &&
|
||||||
type.GetProperty("Id") != null &&
|
type.GetProperty("Id") != null &&
|
||||||
(type.GetProperty("Id").GetAccessors()).All(x => x.IsVirtual) &&
|
(type.GetProperty("Id").GetAccessors()).All(x => x.IsVirtual) &&
|
||||||
!type.IsSealed &&
|
!type.IsSealed &&
|
||||||
|
|||||||
@@ -150,6 +150,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ContentManagement\Extensions\DriverResultExtensions.cs" />
|
<Compile Include="ContentManagement\Extensions\DriverResultExtensions.cs" />
|
||||||
<Compile Include="ContentManagement\Handlers\CloneContentContext.cs" />
|
<Compile Include="ContentManagement\Handlers\CloneContentContext.cs" />
|
||||||
|
<Compile Include="Data\MapAsRecordAttribute.cs" />
|
||||||
<Compile Include="Data\Migration\Interpreters\PostgreSqlCommandInterpreter.cs" />
|
<Compile Include="Data\Migration\Interpreters\PostgreSqlCommandInterpreter.cs" />
|
||||||
<Compile Include="DisplayManagement\Descriptors\ShapePlacementStrategy\DefaultPlacementParseMatchProviders.cs" />
|
<Compile Include="DisplayManagement\Descriptors\ShapePlacementStrategy\DefaultPlacementParseMatchProviders.cs" />
|
||||||
<Compile Include="DisplayManagement\Descriptors\ShapePlacementStrategy\IPlacementParseMatchProvider.cs" />
|
<Compile Include="DisplayManagement\Descriptors\ShapePlacementStrategy\IPlacementParseMatchProvider.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user