初始化

This commit is contained in:
2025-11-20 09:14:00 +08:00
commit 611f7cbaf5
98 changed files with 15987 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Caching.Memory;
namespace WebAPIServer.Common
{
public class MyMemoryCache
{
public MemoryCache Cache { get; } = new MemoryCache(
new MemoryCacheOptions
{
SizeLimit = 1024
});
}
}

View File

@@ -0,0 +1,30 @@
using System.Reflection;
using IronPython.Hosting;
using Microsoft.Scripting.Hosting;
using SupplierManager.Extensions;
namespace SupplierManager.Common
{
public class StaticData
{
public readonly static object obj = new object();
public static ScriptEngine eng = Python.CreateEngine();
public static ScriptScope scope1 = eng.CreateScope();
public static ScriptScope scope2 = eng.CreateScope();
public static ScriptScope scope3 = eng.CreateScope();
public static void GetWebAPIMethod()
{
eng.Runtime.LoadAssembly(Assembly.GetExecutingAssembly());
eng.ExecuteFile("script\\webapi.py", scope1);
}
public static void GetWebAPIMethod1()
{
eng.ExecuteFile("script\\a.py", scope1);
}
public static void GetWebAPIMethod2()
{
eng.ExecuteFile("script\\b.py", scope1);
}
}
}