39 lines
994 B
C#
39 lines
994 B
C#
using System;
|
|
using System.Collections.Concurrent;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using JNPF.Common.Extension;
|
|
using JNPF.DependencyInjection;
|
|
using JNPF.VisualDev.Entitys;
|
|
using JNPF.VisualDev.Interfaces;
|
|
using Microsoft.AspNetCore.Mvc.Filters;
|
|
|
|
namespace JNPF.VisualDev
|
|
{
|
|
public class OverideVisualDevManager
|
|
{
|
|
private static ConcurrentDictionary<string, Type> actions = new ConcurrentDictionary<string, Type>();
|
|
public OverideVisualDevManager()
|
|
{
|
|
}
|
|
|
|
public static IOverideVisualDevService? GetOrDefault(string modelId)
|
|
{
|
|
var tp = actions.GetOrDefault(modelId);
|
|
if (tp != null) { return (IOverideVisualDevService)App.GetService(tp); }
|
|
return null;
|
|
}
|
|
|
|
public static void Add(string modelId, Type overideVisualDev)
|
|
{
|
|
if (!actions.ContainsKey(modelId))
|
|
{
|
|
actions.TryAdd(modelId, overideVisualDev);
|
|
}
|
|
}
|
|
}
|
|
}
|