|
|
|
|
@ -1,16 +1,19 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
{
|
|
|
|
|
public static class ModuleExtensionConfigurationHelper
|
|
|
|
|
{
|
|
|
|
|
private static object SyncLock = new object();
|
|
|
|
|
|
|
|
|
|
public static void ApplyEntityConfigurationToEntity(
|
|
|
|
|
string moduleName,
|
|
|
|
|
string entityName,
|
|
|
|
|
Type entityType)
|
|
|
|
|
{
|
|
|
|
|
lock (SyncLock)
|
|
|
|
|
{
|
|
|
|
|
foreach (var propertyConfig in GetPropertyConfigurations(moduleName, entityName))
|
|
|
|
|
{
|
|
|
|
|
@ -21,6 +24,7 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ApplyEntityConfigurationToApi(
|
|
|
|
|
string moduleName,
|
|
|
|
|
@ -28,6 +32,8 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
Type[] getApiTypes = null,
|
|
|
|
|
Type[] createApiTypes = null,
|
|
|
|
|
Type[] updateApiTypes = null)
|
|
|
|
|
{
|
|
|
|
|
lock (SyncLock)
|
|
|
|
|
{
|
|
|
|
|
foreach (var propertyConfig in GetPropertyConfigurations(moduleName, objectName))
|
|
|
|
|
{
|
|
|
|
|
@ -55,12 +61,15 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ApplyEntityConfigurationToUi(
|
|
|
|
|
string moduleName,
|
|
|
|
|
string entityName,
|
|
|
|
|
Type[] createFormTypes = null,
|
|
|
|
|
Type[] editFormTypes = null)
|
|
|
|
|
{
|
|
|
|
|
lock (SyncLock)
|
|
|
|
|
{
|
|
|
|
|
foreach (var propertyConfig in GetPropertyConfigurations(moduleName, entityName))
|
|
|
|
|
{
|
|
|
|
|
@ -82,6 +91,7 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ApplyEntityConfigurations(
|
|
|
|
|
string moduleName,
|
|
|
|
|
@ -92,6 +102,8 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
Type[] getApiTypes = null,
|
|
|
|
|
Type[] createApiTypes = null,
|
|
|
|
|
Type[] updateApiTypes = null)
|
|
|
|
|
{
|
|
|
|
|
lock (SyncLock)
|
|
|
|
|
{
|
|
|
|
|
if (entityType != null)
|
|
|
|
|
{
|
|
|
|
|
@ -117,11 +129,14 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
editFormTypes: editFormTypes
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[NotNull]
|
|
|
|
|
public static IEnumerable<ExtensionPropertyConfiguration> GetPropertyConfigurations(
|
|
|
|
|
string moduleName,
|
|
|
|
|
string entityName)
|
|
|
|
|
{
|
|
|
|
|
lock (SyncLock)
|
|
|
|
|
{
|
|
|
|
|
var moduleConfig = ObjectExtensionManager.Instance.Modules().GetOrDefault(moduleName);
|
|
|
|
|
if (moduleConfig == null)
|
|
|
|
|
@ -137,10 +152,13 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
|
|
|
|
|
return objectConfig.GetProperties();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ApplyPropertyConfigurationToTypes(
|
|
|
|
|
ExtensionPropertyConfiguration propertyConfig,
|
|
|
|
|
Type[] types)
|
|
|
|
|
{
|
|
|
|
|
lock (SyncLock)
|
|
|
|
|
{
|
|
|
|
|
ObjectExtensionManager.Instance
|
|
|
|
|
.AddOrUpdateProperty(
|
|
|
|
|
@ -160,4 +178,5 @@ namespace Volo.Abp.ObjectExtending.Modularity
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|