初始化
This commit is contained in:
13
SupplierManager/Common/MyMemoryCache.cs
Normal file
13
SupplierManager/Common/MyMemoryCache.cs
Normal 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
|
||||
});
|
||||
}
|
||||
}
|
||||
30
SupplierManager/Common/StaticData.cs
Normal file
30
SupplierManager/Common/StaticData.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user