diff --git a/29WxOrder.sln b/29WxOrder.sln
index cbb0fa1..2b5b26e 100644
--- a/29WxOrder.sln
+++ b/29WxOrder.sln
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_SolutionItems", "_Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
+ Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WxOrder.Framework", "WxOrder.Framework\WxOrder.Framework.csproj", "{3123963C-A0EC-4AD5-9916-DC063F73490B}"
@@ -25,6 +26,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".test", ".test", "{14261B9B
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WXOrder.Test", "test\WXOrder.Test\WXOrder.Test.csproj", "{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trade.Client", "Source\Trade.Client\Trade.Client.csproj", "{BCABF48D-183D-A66F-33B6-B865CC0AD623}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAX.Core", "Source\MAX.Core\MAX.Core.csproj", "{313C8137-00DA-4116-B3B4-68FC45CC0CE7}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trade.Framework", "Source\Trade.Framework\Trade.Framework.csproj", "{0180FDFA-6984-462D-B406-65B460CDB47A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Main.Test", "Main.Test\Main.Test.csproj", "{890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MAX.Framework", "Source\MAX.Framework\MAX.Framework.csproj", "{EABFACFE-C74D-4111-9683-C6E7714F432D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -117,6 +128,86 @@ Global
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}.Release|x64.Build.0 = Release|Any CPU
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}.Release|x86.ActiveCfg = Release|Any CPU
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7}.Release|x86.Build.0 = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x64.Build.0 = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Debug|x86.Build.0 = Debug|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x64.ActiveCfg = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x64.Build.0 = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x86.ActiveCfg = Release|Any CPU
+ {BCABF48D-183D-A66F-33B6-B865CC0AD623}.Release|x86.Build.0 = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x64.Build.0 = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Debug|x86.Build.0 = Debug|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Any CPU.Build.0 = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x64.ActiveCfg = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x64.Build.0 = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x86.ActiveCfg = Release|Any CPU
+ {313C8137-00DA-4116-B3B4-68FC45CC0CE7}.Release|x86.Build.0 = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x64.Build.0 = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Debug|x86.Build.0 = Debug|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x64.ActiveCfg = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x64.Build.0 = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x86.ActiveCfg = Release|Any CPU
+ {0180FDFA-6984-462D-B406-65B460CDB47A}.Release|x86.Build.0 = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x64.Build.0 = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Debug|x86.Build.0 = Debug|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x64.ActiveCfg = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x64.Build.0 = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x86.ActiveCfg = Release|Any CPU
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF}.Release|x86.Build.0 = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x64.Build.0 = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Debug|x86.Build.0 = Debug|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x64.ActiveCfg = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x64.Build.0 = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x86.ActiveCfg = Release|Any CPU
+ {EABFACFE-C74D-4111-9683-C6E7714F432D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -126,6 +217,7 @@ Global
{1AD45D66-6872-4522-ACF0-04E2C0514048} = {4A54DC2A-B47C-4ED1-A482-EE60161DB2C3}
{5A410EB5-06AD-97BB-2314-9D7A808E12F7} = {1A7830FA-AC8F-40FB-A232-F0626812B8BE}
{3790EC79-EA1D-4660-AB0D-EA0DE4FF77B7} = {14261B9B-E3EA-4BC0-B08D-4B3591AC13E5}
+ {890E871A-F6E7-42DA-85D5-3BF2F8ECAEDF} = {14261B9B-E3EA-4BC0-B08D-4B3591AC13E5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {38687A61-0347-49AC-98C7-E7F7148C0234}
diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000..b60289c
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,24 @@
+
+
+
+
+ net8.0
+ $(DefaultTargetFramework)
+ 12.0
+ true
+ false
+ true
+ annotations
+ CS1591
+ enable
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
diff --git a/Main.Test/App.xaml b/Main.Test/App.xaml
new file mode 100644
index 0000000..543a120
--- /dev/null
+++ b/Main.Test/App.xaml
@@ -0,0 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/Main.Test/App.xaml.cs b/Main.Test/App.xaml.cs
new file mode 100644
index 0000000..91ae68a
--- /dev/null
+++ b/Main.Test/App.xaml.cs
@@ -0,0 +1,57 @@
+using Main.Test.ViewModels;
+using Main.Test.Views;
+using MAX.Core.DependencyInjection;
+using MAX.Core.Logger;
+using Prism.Ioc;
+using Prism.Modularity;
+using Prism.Mvvm;
+using System.Configuration;
+using System.Data;
+using System.Windows;
+using Trade.Framework;
+using Trade.Framework.Extensions;
+using Trade.Framework.Services;
+
+namespace Main.Test;
+///
+/// Interaction logic for App.xaml
+///
+public partial class App : FrameworkApplication
+{
+ public IScopedProvider CurrentScope => throw new NotImplementedException();
+
+ protected override void OnStartup(StartupEventArgs e)
+ {
+ base.OnStartup(e);
+
+ }
+ protected override Window CreateShell()
+ {
+ return Container.Resolve();
+ }
+
+ protected override void RegisterTypes(IContainerRegistry containerRegistry)
+ {
+ // 严格模式:FrameworkApplication 已关闭 DryIoc 按需动态注册(WithConcreteTypeDynamicRegistrations),
+ // 所有被解析的类型必须显式注册,否则抛 ContainerException。
+
+ // 启动 Shell
+ containerRegistry.Register();
+
+ // 窗口/控件 ViewModel(DISource 从容器解析)
+ containerRegistry.Register();
+ containerRegistry.Register();
+
+ // 对话框:RegisterDialog 只注册 View 本身,VM 由 ViewModelLocator 从容器解析,需单独注册
+ containerRegistry.RegisterDialog(nameof(bbbDialogView));
+ containerRegistry.Register();
+
+ // 服务:原先靠 DryIoc 动态注册(Transient),显式注册保持同样行为
+ //containerRegistry.Register();
+ // 若希望 UserManager 全局只实例化一次:
+ // containerRegistry.RegisterSingleton();
+
+ //containerRegistry.RegisterSingleton();
+ }
+
+}
diff --git a/Main.Test/AssemblyInfo.cs b/Main.Test/AssemblyInfo.cs
new file mode 100644
index 0000000..d9a1bde
--- /dev/null
+++ b/Main.Test/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/Main.Test/Main.Test.csproj b/Main.Test/Main.Test.csproj
new file mode 100644
index 0000000..a6124fb
--- /dev/null
+++ b/Main.Test/Main.Test.csproj
@@ -0,0 +1,24 @@
+
+
+
+ WinExe
+ $(DefaultTargetFramework)-windows
+ enable
+ enable
+ true
+
+
+
+
+
+
+
+
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+
+
+
+
diff --git a/Main.Test/MainWindow.xaml b/Main.Test/MainWindow.xaml
new file mode 100644
index 0000000..54af584
--- /dev/null
+++ b/Main.Test/MainWindow.xaml
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/Main.Test/MainWindow.xaml.cs b/Main.Test/MainWindow.xaml.cs
new file mode 100644
index 0000000..7e781b9
--- /dev/null
+++ b/Main.Test/MainWindow.xaml.cs
@@ -0,0 +1,22 @@
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Main.Test;
+///
+/// Interaction logic for MainWindow.xaml
+///
+public partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+}
\ No newline at end of file
diff --git a/Main.Test/ViewModels/HeaderViewModel.cs b/Main.Test/ViewModels/HeaderViewModel.cs
new file mode 100644
index 0000000..5e66fd0
--- /dev/null
+++ b/Main.Test/ViewModels/HeaderViewModel.cs
@@ -0,0 +1,30 @@
+using CommunityToolkit.Mvvm.Input;
+using Main.Test.Views;
+using Prism.Commands;
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+
+namespace Main.Test.ViewModels;
+
+internal class HeaderViewModel
+{
+ private readonly IDialogService _dialogService;
+
+ public HeaderViewModel(IDialogService dialogService)
+ {
+ _dialogService = dialogService;
+ }
+ //public ICommand ccCommand => new AsyncDelegateCommand(cc);
+
+
+ [RelayCommand]
+ private async Task cc()
+ {
+ _dialogService.ShowDialog(nameof(bbbDialogView));
+ }
+}
diff --git a/Main.Test/ViewModels/MainViewModel.cs b/Main.Test/ViewModels/MainViewModel.cs
new file mode 100644
index 0000000..eacab68
--- /dev/null
+++ b/Main.Test/ViewModels/MainViewModel.cs
@@ -0,0 +1,20 @@
+using MAX.Core.Logger;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Trade.Framework.Services;
+
+namespace Main.Test.ViewModels;
+
+internal class MainViewModel
+{
+ private readonly ILoggerFacade _logger;
+
+ public MainViewModel(ILoggerFacade logger, UserManager userManager)
+ {
+ _logger = logger;
+ _logger.Info("123123");
+ }
+}
diff --git a/Main.Test/Views/HeaderView.xaml b/Main.Test/Views/HeaderView.xaml
new file mode 100644
index 0000000..43d13e7
--- /dev/null
+++ b/Main.Test/Views/HeaderView.xaml
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/Main.Test/Views/HeaderView.xaml.cs b/Main.Test/Views/HeaderView.xaml.cs
new file mode 100644
index 0000000..37565d7
--- /dev/null
+++ b/Main.Test/Views/HeaderView.xaml.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Main.Test.Views;
+
+///
+/// HeaderView.xaml 的交互逻辑
+///
+public partial class HeaderView : UserControl
+{
+ public HeaderView()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/Main.Test/Views/bbbDialogView.xaml b/Main.Test/Views/bbbDialogView.xaml
new file mode 100644
index 0000000..bd2b35e
--- /dev/null
+++ b/Main.Test/Views/bbbDialogView.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/Main.Test/Views/bbbDialogView.xaml.cs b/Main.Test/Views/bbbDialogView.xaml.cs
new file mode 100644
index 0000000..bf5d5b6
--- /dev/null
+++ b/Main.Test/Views/bbbDialogView.xaml.cs
@@ -0,0 +1,57 @@
+using Prism.Services.Dialogs;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Trade.Framework.Services;
+
+namespace Main.Test.Views;
+
+///
+/// bbbDialogView.xaml 的交互逻辑
+///
+public partial class bbbDialogView : UserControl
+{
+ public bbbDialogView()
+ {
+ InitializeComponent();
+ }
+}
+public class bbbDialogViewModel : IDialogAware
+{
+ private readonly IUserManager _user;
+
+ public bbbDialogViewModel(IUserManager user)
+ {
+ _user = user;
+ }
+ public string Title => "ttt";
+
+ public event Action RequestClose;
+
+ public bool CanCloseDialog()
+ {
+
+ return true;
+ }
+
+ public void OnDialogClosed()
+ {
+ return;
+ }
+
+ public void OnDialogOpened(IDialogParameters parameters)
+ {
+ return;
+ }
+}
\ No newline at end of file
diff --git a/Source/MAX.Core/Autofac/AutowiredAttribute.cs b/Source/MAX.Core/Autofac/AutowiredAttribute.cs
new file mode 100644
index 0000000..f82ae6a
--- /dev/null
+++ b/Source/MAX.Core/Autofac/AutowiredAttribute.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace MAX.Core.Autofac
+{
+ ///
+ /// 自动填充属性特性
+ ///
+ [AttributeUsage(AttributeTargets.Property)]
+ public class AutowiredAttribute : Attribute
+ {
+ }
+}
diff --git a/Source/MAX.Core/Autofac/CustomPropertySelector.cs b/Source/MAX.Core/Autofac/CustomPropertySelector.cs
new file mode 100644
index 0000000..452d089
--- /dev/null
+++ b/Source/MAX.Core/Autofac/CustomPropertySelector.cs
@@ -0,0 +1,23 @@
+using Autofac.Core;
+using System.Linq;
+using System.Reflection;
+
+namespace MAX.Core.Autofac
+{
+ ///
+ /// autofac 找出所有属性上是否摸个特性
+ ///
+ public class CustomPropertySelector : IPropertySelector
+ {
+ public bool InjectProperty(PropertyInfo propertyInfo, object instance)
+ {
+ if (propertyInfo.CustomAttributes.Any(iterator => iterator.AttributeType == typeof(AutowiredAttribute)))
+ {
+
+ }
+ //需要一个判断
+ //;如果标记的有CustomPropertyAttribute特性返回True:返回true;就构造实例
+ return propertyInfo.CustomAttributes.Any(iterator => iterator.AttributeType == typeof(AutowiredAttribute));
+ }
+ }
+}
diff --git a/Source/MAX.Core/Autofac/IDependencyRegistrar.cs b/Source/MAX.Core/Autofac/IDependencyRegistrar.cs
new file mode 100644
index 0000000..e3f7478
--- /dev/null
+++ b/Source/MAX.Core/Autofac/IDependencyRegistrar.cs
@@ -0,0 +1,9 @@
+using Autofac;
+
+namespace MAX.Core.Autofac
+{
+ public interface IDependencyRegistrar
+ {
+ void Register(ContainerBuilder builder);
+ }
+}
diff --git a/Source/MAX.Core/Autofac/IocManager.cs b/Source/MAX.Core/Autofac/IocManager.cs
new file mode 100644
index 0000000..f604681
--- /dev/null
+++ b/Source/MAX.Core/Autofac/IocManager.cs
@@ -0,0 +1,107 @@
+using Autofac;
+using Autofac.Core;
+using System;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MAX.Core.DependencyInjection;
+
+///
+/// 容器
+///
+public static partial class IocManager
+{
+ ///
+ /// 默认容器
+ ///
+ public static IContainer Container { get; internal set; }
+ public static void SetContainer(IContainer container)
+ {
+ Container = container;
+ }
+
+ ///
+ /// 确定指定的服务在上下文中是否可用。
+ ///
+ ///
+ ///
+ public static bool IsRegistered()
+ {
+ return Container.IsRegistered();
+ }
+ ///
+ /// 确定指定的服务在上下文中是否可用。
+ ///
+ ///
+ ///
+ public static bool IsRegistered(Type serverType)
+ {
+ return Container.IsRegistered(serverType);
+ }
+
+ public static TService Resolve()
+ {
+ if (Container.IsRegistered())
+ {
+ return Container.Resolve();
+ }
+ return default;
+ }
+ public static object Resolve(Type serviceType)
+ {
+ if (Container.IsRegistered(serviceType))
+ {
+ return Container.Resolve(serviceType);
+ }
+ return default;
+ }
+ public static TService Resolve(params Parameter[] parameters)
+ {
+ if (Container.IsRegistered())
+ {
+ return Container.Resolve(parameters);
+ }
+ return default;
+ }
+ ///
+ /// 获取所有注册
+ ///
+ ///
+ ///
+ public static TService[] ResolveAll()
+ {
+ return ResolveAll(typeof(TService)) as TService[];
+ }
+ ///
+ /// 获取所有注册
+ ///
+ ///
+ ///
+ public static object[] ResolveAll(Type type)
+ {
+ Type enumerableOfType = typeof(IEnumerable<>).MakeGenericType(type);
+ return (object[])Container.ResolveService(new TypedService(enumerableOfType));
+ }
+
+ public static Type GetRegistrationType(string key)
+ {
+ foreach (IComponentRegistration registration in Container.ComponentRegistry.Registrations)
+ {
+ foreach (Service service in registration.Services)
+ {
+ if (service is KeyedService ks)
+ {
+ if (key.Equals(ks.ServiceKey.ToString(), StringComparison.Ordinal))
+ {
+ if (Container.ComponentRegistry.TryGetServiceRegistration(service, out ServiceRegistration serviceRegistration))
+ {
+ return serviceRegistration.Registration.Target.Activator.LimitType;
+ }
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/Source/MAX.Core/Caches/ICache.cs b/Source/MAX.Core/Caches/ICache.cs
new file mode 100644
index 0000000..9407565
--- /dev/null
+++ b/Source/MAX.Core/Caches/ICache.cs
@@ -0,0 +1,99 @@
+using System;
+
+namespace MAX.Core.Caches;
+
+///
+/// 缓存
+///
+public interface ICache
+{
+ ///
+ /// 是否存在指定键的缓存
+ ///
+ /// 缓存键
+ bool Exists(string key);
+ ///
+ /// 从缓存中获取数据
+ ///
+ ///
+ ///
+ T Get(string key);
+ ///
+ /// 从缓存中获取数据,如果不存在,则执行获取数据操作并添加到缓存中
+ ///
+ /// 缓存数据类型
+ /// 缓存键
+ /// 获取数据操作
+ T Get(string key, Func func);
+ ///
+ /// 当缓存数据不存在则添加,已存在不会添加,添加成功返回true
+ ///
+ /// 缓存数据类型
+ /// 缓存键
+ /// 值
+ bool TryAdd(string key, T value);
+ ///
+ /// 覆盖添加
+ ///
+ ///
+ ///
+ ///
+ ///
+ bool OverlayAdd(string key, T value);
+ ///
+ /// 移除缓存
+ ///
+ /// 缓存键
+ void Remove(string key);
+ ///
+ /// 清空缓存
+ ///
+ void Clear();
+}
+
+public interface ICache
+{
+ ///
+ /// 是否存在指定键的缓存
+ ///
+ /// 缓存键
+ bool Exists(string key);
+
+ ///
+ /// 从缓存中获取数据,如果不存在,则执行获取数据操作并添加到缓存中
+ ///
+ /// 缓存数据类型
+ /// 缓存键
+ T Get(string key);
+ ///
+ /// 从缓存中获取数据,如果不存在,则执行获取数据操作并添加到缓存中
+ ///
+ /// 缓存数据类型
+ /// 缓存键
+ /// 获取数据操作
+ T Get(string key, Func func);
+ ///
+ /// 当缓存数据不存在则添加,已存在不会添加,添加成功返回true
+ ///
+ /// 缓存数据类型
+ /// 缓存键
+ /// 值
+ bool TryAdd(string key, T value);
+ ///
+ /// 覆盖添加
+ ///
+ ///
+ ///
+ ///
+ ///
+ bool OverlayAdd(string key, T value);
+ ///
+ /// 移除缓存
+ ///
+ /// 缓存键
+ void Remove(string key);
+ ///
+ /// 清空缓存
+ ///
+ void Clear();
+}
diff --git a/Source/MAX.Core/Caches/MemoryCache.cs b/Source/MAX.Core/Caches/MemoryCache.cs
new file mode 100644
index 0000000..b2bc36a
--- /dev/null
+++ b/Source/MAX.Core/Caches/MemoryCache.cs
@@ -0,0 +1,168 @@
+
+using MAX.Core.DependencyInjection;
+using MAX.Core.Infrastructure;
+using System;
+using System.Collections.Concurrent;
+using System.Linq;
+
+namespace MAX.Core.Caches;
+
+///
+/// 内存缓存
+///
+public class MemoryCache : ICache, ISingletonDependency
+{
+ //private static readonly Object _locker = new object();
+ private readonly ConcurrentDictionary _cache = new();
+
+ public virtual void Clear()
+ {
+ _cache.Clear();
+ }
+
+ public virtual bool Exists(string key)
+ {
+ return _cache.ContainsKey(key);
+ }
+ public virtual T Get(string key)
+ {
+ if (Exists(key))
+ {
+ return (T)_cache[key];
+ }
+ return default;
+ }
+ public virtual TResult Get(string key, Func func)
+ {
+ if (Exists(key))
+ {
+ return (TResult)_cache[key];
+ }
+ else
+ {
+ if (func != null)
+ {
+ TResult t = func();
+ TryAdd(key, t);
+ return t;
+ }
+ }
+ return default;
+ }
+
+ public virtual bool OverlayAdd(string key, T value)
+ {
+ if (Exists(key))
+ {
+ _cache[key] = value;
+ }
+ else
+ {
+ _cache.TryAdd(key, value);
+ }
+ return true;
+ }
+
+ public virtual void Remove(string key)
+ {
+ _cache.TryRemove(key, out _);
+ }
+
+ public virtual bool TryAdd(string key, T value)
+ {
+ _cache.AddOrUpdate(key, value, (oldkey, oldvalue) => value);
+ return true;
+ }
+ ///
+ /// 获取所有Key
+ ///
+ ///
+ public string[] AllKeys()
+ {
+ return _cache.Keys.ToArray();
+ }
+}
+///
+/// 单例缓存抽象类
+///
+/// 单例对象
+/// 缓存类型
+public abstract class SingleInstanceLittleCache : SingleInstance, ICache where TModel : class
+{
+ private readonly ConcurrentDictionary _cache = new();
+ ///
+ /// 自定义前缀
+ ///
+ //public abstract string KeyPrefix { get; }
+ //private string FormatKey(string key)
+ //{
+ // return KeyPrefix + key;
+ //}
+
+ public virtual void Clear()
+ {
+ _cache.Clear();
+ }
+
+ public virtual bool Exists(string key)
+ {
+ return _cache.ContainsKey(key);
+ }
+ public virtual TValue Get(string key)
+ {
+ if (Exists(key))
+ {
+ return _cache[key];
+ }
+ return default;
+ }
+ public virtual TValue Get(string key, Func func)
+ {
+ if (Exists(key))
+ {
+ return _cache[key];
+ }
+ else
+ {
+ if (func != null)
+ {
+ TValue t = func();
+ TryAdd(key, t);
+ return t;
+ }
+ }
+ return default;
+ }
+
+ public virtual bool OverlayAdd(string key, TValue value)
+ {
+ if (Exists(key))
+ {
+ _cache[key] = value;
+ }
+ else
+ {
+ _cache.TryAdd(key, value);
+ }
+ return true;
+ }
+
+ public virtual void Remove(string key)
+ {
+ _cache.TryRemove(key, out _);
+ }
+
+ public virtual bool TryAdd(string key, TValue value)
+ {
+ _cache.AddOrUpdate(key, value, (oldkey, oldvalue) => value);
+ return true;
+ }
+ ///
+ /// 获取所有Key
+ ///
+ ///
+ public string[] AllKeys()
+ {
+ return _cache.Keys.ToArray();
+ }
+}
diff --git a/Source/MAX.Core/Commons/CommonValue.cs b/Source/MAX.Core/Commons/CommonValue.cs
new file mode 100644
index 0000000..ddcd731
--- /dev/null
+++ b/Source/MAX.Core/Commons/CommonValue.cs
@@ -0,0 +1,37 @@
+namespace MAX.Core.Commons;
+
+///
+/// 公共Value
+///
+///
+public class CommonValue
+{
+ public CommonValue() { }
+ public CommonValue(TValue value)
+ {
+ Value = value;
+ }
+ public TValue Value { get; set; }
+}
+///
+/// 公共TextValue
+///
+///
+public class CommonTextValue : CommonValue
+{
+ public string Text { get; set; }
+}
+///
+/// 公共TextValue
+///
+public class CommonTextValue : CommonTextValue
+{
+
+}
+///
+/// 默认公共键值对 Key Value
+///
+public class CommonKeyValue : CommonValue
+{
+ public string Key { get; set; }
+}
diff --git a/Source/MAX.Core/Commons/Result.cs b/Source/MAX.Core/Commons/Result.cs
new file mode 100644
index 0000000..5d71941
--- /dev/null
+++ b/Source/MAX.Core/Commons/Result.cs
@@ -0,0 +1,55 @@
+using System;
+
+namespace MAX.Core.Commons;
+
+///
+/// 通用返回
+///
+public class Result
+{
+ ///
+ /// 返回结果是否成功
+ ///
+ public bool Success { get; set; } = false;
+ ///
+ /// 返回消息
+ ///
+ public string Msg { get; set; } = "";
+ ///
+ /// 返回内容
+ ///
+ public object Data { get; set; } = null;
+
+ ///
+ /// 返回状态码
+ ///
+ public int Code { get; set; }
+
+}
+///
+/// 通用返回 指定Data类型
+///
+/// 数据类型
+public class Result : Result
+{
+ ///
+ /// 返回内容
+ ///
+ public new TData Data { get; set; }
+}
+///
+/// 通用返回
+///
+/// 状态类型枚举
+/// 数据类型
+public class Result : Result where TStatus : Enum
+{
+ ///
+ /// 状态
+ ///
+ public TStatus Status { get; set; }
+ ///
+ /// 返回内容
+ ///
+ public new TData Data { get; set; }
+}
diff --git a/Source/MAX.Core/Cryptography/Base64Helper.cs b/Source/MAX.Core/Cryptography/Base64Helper.cs
new file mode 100644
index 0000000..768c732
--- /dev/null
+++ b/Source/MAX.Core/Cryptography/Base64Helper.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Text;
+
+namespace MAX.Core.Cryptography;
+
+public class Base64Helper
+{
+ ///
+ /// Base64加密
+ ///
+ /// 加密采用的编码方式
+ /// 待加密的明文
+ ///
+ public static string Encode(string source, Encoding encode)
+ {
+ string encodeValue = "";
+ byte[] bytes = encode.GetBytes(source);
+ try
+ {
+ encodeValue = Convert.ToBase64String(bytes);
+ }
+ catch
+ {
+ encodeValue = source;
+ }
+ return encodeValue;
+ }
+
+ ///
+ /// Base64加密,采用utf8编码方式加密
+ ///
+ /// 待加密的明文
+ /// 加密后的字符串
+ public static string Encode(string source)
+ {
+ return Encode(source, Encoding.UTF8);
+ }
+
+ ///
+ /// Base64解密
+ ///
+ /// 解密采用的编码方式,注意和加密时采用的方式一致
+ /// 待解密的密文
+ /// 解密后的字符串
+ public static string Decode(string result, Encoding encode)
+ {
+ string decode = "";
+ byte[] bytes = Convert.FromBase64String(result);
+ try
+ {
+ decode = encode.GetString(bytes);
+ }
+ catch
+ {
+ decode = result;
+ }
+ return decode;
+ }
+
+ ///
+ /// Base64解密,采用utf8编码方式解密
+ ///
+ /// 待解密的密文
+ /// 解密后的字符串
+ public static string Decode(string result)
+ {
+ return Decode(result, Encoding.UTF8);
+ }
+}
diff --git a/Source/MAX.Core/Cryptography/DESHelper.cs b/Source/MAX.Core/Cryptography/DESHelper.cs
new file mode 100644
index 0000000..67e37f0
--- /dev/null
+++ b/Source/MAX.Core/Cryptography/DESHelper.cs
@@ -0,0 +1,215 @@
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MAX.Core.Cryptography;
+
+public sealed class DESHelper
+{
+
+ //默认密钥向量
+ private static readonly byte[] IVKey = { 36, 109, 97, 120, 111, 110, 120, 36 };
+ ///
+ /// DES加密字符串
+ ///
+ /// 待加密的字符串
+ /// 加密密钥,要求为8位
+ /// 加密成功返回加密后的字符串,失败返回源串
+ public static string Encrypt(string encryptString, string encryptKey)
+ {
+ try
+ {
+ encryptKey = GetSubString(encryptKey, 8, "");
+ encryptKey = encryptKey.PadRight(8, ' ');
+ byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8));
+ byte[] rgbIV = IVKey;
+ byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString);
+ DES dCSP = DES.Create();
+ MemoryStream mStream = new();
+ CryptoStream cStream = new(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
+ cStream.Write(inputByteArray, 0, inputByteArray.Length);
+ cStream.FlushFinalBlock();
+ return Convert.ToBase64String(mStream.ToArray());
+ }
+ catch
+ {
+ return encryptString;
+ }
+ }
+
+ ///
+ /// DES解密字符串
+ ///
+ /// 待解密的字符串
+ /// 解密密钥,要求为8位,和加密密钥相同
+ /// 解密成功返回解密后的字符串,失败返源串
+ public static string Decrypt(string decryptString, string decryptKey)
+ {
+ try
+ {
+ decryptKey = GetSubString(decryptKey, 0, 8, "");
+ decryptKey = decryptKey.PadRight(8, ' ');
+ byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey);
+ byte[] rgbIV = IVKey;
+ byte[] inputByteArray = Convert.FromBase64String(decryptString);
+ DES DCSP = DES.Create();
+
+ MemoryStream mStream = new();
+ CryptoStream cStream = new(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), CryptoStreamMode.Write);
+ cStream.Write(inputByteArray, 0, inputByteArray.Length);
+ cStream.FlushFinalBlock();
+ return Encoding.UTF8.GetString(mStream.ToArray());
+ }
+ catch
+ {
+ return string.Empty;
+ }
+
+ }
+
+ #region 截取字符串函数
+
+ ///
+ /// 截取字符串函数
+ ///
+ /// 所要截取的字符串
+ /// 截取字符串的长度
+ ///
+ public static string GetSubString(string Str, int Num)
+ {
+ if (Str is null or "")
+ {
+ return "";
+ }
+ string outstr = string.Empty;
+ int n = 0;
+ foreach (char ch in Str)
+ {
+ n += Encoding.Default.GetByteCount(ch.ToString());
+
+ if (n > Num)
+ {
+ break;
+ }
+ else
+ {
+ outstr += ch;
+ }
+ }
+
+ return outstr;
+ }
+ ///
+ /// 截取字符串函数,如果超过指定长度则将超出的部分用指定字符串代替
+ ///
+ /// 所要截取的字符串
+ /// 截取字符串的长度
+ /// 截取字符串后省略部分的字符串
+ ///
+ public static string GetSubString(string Str, int Num, string LastStr)
+ {
+ return GetSubString(Str, 0, Num, LastStr);
+ }
+
+ #endregion
+
+ #region 截取字符串,超过部分用指定字符串替换
+
+ /* 宗波于 2010-6-12 日添加, 来源于DiscuzNt */
+ ///
+ /// 取指定长度的字符串
+ ///
+ /// 要检查的字符串
+ /// 起始位置
+ /// 指定长度
+ /// 用于替换的字符串
+ /// 截取后的字符串
+ public static string GetSubString(string p_SrcString, int p_StartIndex, int p_Length, string p_TailString)
+ {
+ string myResult = p_SrcString;
+
+ byte[] bComments = Encoding.UTF8.GetBytes(p_SrcString);
+ foreach (char c in Encoding.UTF8.GetChars(bComments))
+ { //当是日文或韩文时(注:中文的范围:\u4e00 - \u9fa5, 日文在\u0800 - \u4e00, 韩文为\xAC00-\xD7A3)
+ if (c is (> '\u0800' and < '\u4e00') or (> '\xAC00' and < '\xD7A3'))
+ {
+ //if (System.Text.RegularExpressions.Regex.IsMatch(p_SrcString, "[\u0800-\u4e00]+") || System.Text.RegularExpressions.Regex.IsMatch(p_SrcString, "[\xAC00-\xD7A3]+"))
+ //当截取的起始位置超出字段串长度时
+ if (p_StartIndex >= p_SrcString.Length)
+ {
+ return "";
+ }
+ else
+ {
+ return p_SrcString.Substring(p_StartIndex,
+ p_Length + p_StartIndex > p_SrcString.Length ? p_SrcString.Length - p_StartIndex : p_Length);
+ }
+ }
+ }
+
+ if (p_Length >= 0)
+ {
+ byte[] bsSrcString = Encoding.Default.GetBytes(p_SrcString);
+
+ //当字符串长度大于起始位置
+ if (bsSrcString.Length > p_StartIndex)
+ {
+ int p_EndIndex = bsSrcString.Length;
+
+ //当要截取的长度在字符串的有效长度范围内
+ if (bsSrcString.Length > p_StartIndex + p_Length)
+ {
+ p_EndIndex = p_Length + p_StartIndex;
+ }
+ else
+ { //当不在有效范围内时,只取到字符串的结尾
+
+ p_Length = bsSrcString.Length - p_StartIndex;
+ p_TailString = "";
+ }
+
+ int nRealLength = p_Length;
+ int[] anResultFlag = new int[p_Length];
+ byte[] bsResult = null;
+
+ int nFlag = 0;
+ for (int i = p_StartIndex; i < p_EndIndex; i++)
+ {
+ if (bsSrcString[i] > 127)
+ {
+ nFlag++;
+ if (nFlag == 3)
+ {
+ nFlag = 1;
+ }
+ }
+ else
+ {
+ nFlag = 0;
+ }
+
+ anResultFlag[i] = nFlag;
+ }
+
+ if (bsSrcString[p_EndIndex - 1] > 127 && anResultFlag[p_Length - 1] == 1)
+ {
+ nRealLength = p_Length + 1;
+ }
+
+ bsResult = new byte[nRealLength];
+
+ Array.Copy(bsSrcString, p_StartIndex, bsResult, 0, nRealLength);
+
+ myResult = Encoding.Default.GetString(bsResult);
+ myResult += p_TailString;
+ }
+ }
+
+ return myResult;
+ }
+
+
+ #endregion
+
+}
diff --git a/Source/MAX.Core/Cryptography/MD5Helper.cs b/Source/MAX.Core/Cryptography/MD5Helper.cs
new file mode 100644
index 0000000..8397396
--- /dev/null
+++ b/Source/MAX.Core/Cryptography/MD5Helper.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace MAX.Core.Cryptography;
+
+public class MD5Helper
+{
+ ///
+ /// MD5加密
+ ///
+ ///
+ ///
+ public static string Md5_32(string instring)
+ {
+ return _Md532(instring);
+ }
+ public static string Md5_Lower32(string instring)
+ {
+ return _Md532(instring, true);
+ }
+ public static string _Md532(string instring, bool IsLower = false)
+ {
+ byte[] result = Encoding.UTF8.GetBytes(string.IsNullOrEmpty(instring) ? "" : instring.Trim());
+ MD5 md5 = MD5.Create();
+ byte[] output = md5.ComputeHash(result);
+ string value = BitConverter.ToString(output).Replace("-", "");
+ if (IsLower)
+ {
+ return value.ToLower();
+ }
+ return value;
+ }
+
+
+ ///
+ /// MD5加密
+ ///
+ ///
+ public static long GetLong(byte[] result)
+ {
+ return
+ Convert.ToInt64(
+ BitConverter.ToString(MD5.Create().ComputeHash(result), 4,
+ 8).Replace("-", ""), 16);
+ }
+
+ ///
+ /// MD5 16位加密转long
+ ///
+ ///
+ ///
+ public static long GetLong(string url)
+ {
+ if (string.IsNullOrEmpty(url))
+ {
+ return 0;
+ }
+
+ return Convert.ToInt64(BitConverter.ToString(MD5.Create().ComputeHash(Encoding.Default.GetBytes(url)), 4, 8).Replace("-", ""), 16);
+ }
+}
diff --git a/Source/MAX.Core/Cryptography/UrlHelper.cs b/Source/MAX.Core/Cryptography/UrlHelper.cs
new file mode 100644
index 0000000..35f2521
--- /dev/null
+++ b/Source/MAX.Core/Cryptography/UrlHelper.cs
@@ -0,0 +1,51 @@
+using System.Text;
+
+namespace MAX.Core.Cryptography;
+
+///
+/// Url 加密 解密
+///
+public class UrlHelper
+{
+ ///
+ /// Url加密
+ ///
+ /// 加密采用的编码方式
+ /// 待加密的明文
+ ///
+ public static string Encode(string source, Encoding encode)
+ {
+ return System.Web.HttpUtility.UrlEncode(source, encode);
+ }
+
+ ///
+ /// Url加密,采用utf8编码方式加密
+ ///
+ /// 待加密的明文
+ /// 加密后的字符串
+ public static string Encode(string source)
+ {
+ return Encode(source, Encoding.UTF8);
+ }
+
+ ///
+ /// Url解密
+ ///
+ /// 解密采用的编码方式,注意和加密时采用的方式一致
+ /// 待解密的密文
+ /// 解密后的字符串
+ public static string Decode(string result, Encoding encode)
+ {
+ return System.Web.HttpUtility.UrlDecode(result, Encoding.UTF8);
+ }
+
+ ///
+ /// Url解密,采用utf8编码方式解密
+ ///
+ /// 待解密的密文
+ /// 解密后的字符串
+ public static string Decode(string result)
+ {
+ return Decode(result, Encoding.UTF8);
+ }
+}
diff --git a/Source/MAX.Core/DependencyInjection/IScopedDependency.cs b/Source/MAX.Core/DependencyInjection/IScopedDependency.cs
new file mode 100644
index 0000000..eb004ed
--- /dev/null
+++ b/Source/MAX.Core/DependencyInjection/IScopedDependency.cs
@@ -0,0 +1,8 @@
+namespace MAX.Core.DependencyInjection;
+
+///
+/// 作用域(每个 Scope/请求一个实例)
+///
+public interface IScopedDependency
+{
+}
diff --git a/Source/MAX.Core/DependencyInjection/IServiceRegistrar.cs b/Source/MAX.Core/DependencyInjection/IServiceRegistrar.cs
new file mode 100644
index 0000000..b2f5755
--- /dev/null
+++ b/Source/MAX.Core/DependencyInjection/IServiceRegistrar.cs
@@ -0,0 +1,81 @@
+//using System;
+
+//namespace MAX.Core.DependencyInjection;
+
+/////
+///// 依赖注册抽象(由 MAX.Core 自己定义,不依赖任何第三方 DI 容器)。
+///// 具体实现由宿主项目提供,内部适配外部容器(Autofac、Microsoft.Extensions.DependencyInjection 等)。
+/////
+//public interface IServiceRegistrar
+//{
+// ///
+// /// 注册单例: 实现
+// ///
+// void RegisterSingleton() where TService : class where TImplementation : class, TService;
+
+// ///
+// /// 注册单例实例
+// ///
+// void RegisterSingleton(TService instance) where TService : class;
+
+// ///
+// /// 注册单例(匿名工厂)
+// ///
+// void RegisterSingleton(Func factory) where TService : class;
+
+// ///
+// /// 注册单例(key): 实现
+// ///
+// void RegisterSingleton(object? serviceKey) where TService : class where TImplementation : class, TService;
+
+// ///
+// /// 注册单例实例(key)
+// ///
+// void RegisterSingleton(object? serviceKey, TService instance) where TService : class;
+
+// ///
+// /// 注册单例(key + 匿名工厂)
+// ///
+// void RegisterSingleton(object? serviceKey, Func factory) where TService : class;
+
+// ///
+// /// 注册作用域生命周期
+// ///
+// void RegisterScoped() where TService : class where TImplementation : class, TService;
+
+// ///
+// /// 注册作用域生命周期(匿名工厂)
+// ///
+// void RegisterScoped(Func factory) where TService : class;
+
+// ///
+// /// 注册作用域生命周期(key): 实现
+// ///
+// void RegisterScoped(object? serviceKey) where TService : class where TImplementation : class, TService;
+
+// ///
+// /// 注册作用域生命周期(key + 匿名工厂)
+// ///
+// void RegisterScoped(object? serviceKey, Func factory) where TService : class;
+
+// ///
+// /// 注册瞬时生命周期
+// ///
+// void RegisterTransient() where TService : class where TImplementation : class, TService;
+
+// ///
+// /// 注册瞬时生命周期(匿名工厂)
+// ///
+// void RegisterTransient(Func factory) where TService : class;
+
+// ///
+// /// 注册瞬时生命周期(key): 实现
+// ///
+// void RegisterTransient(object? serviceKey) where TService : class where TImplementation : class, TService;
+
+// ///
+// /// 注册瞬时生命周期(key + 匿名工厂)
+// ///
+// void RegisterTransient(object? serviceKey, Func factory) where TService : class;
+
+//}
diff --git a/Source/MAX.Core/DependencyInjection/ISingletonDependency.cs b/Source/MAX.Core/DependencyInjection/ISingletonDependency.cs
new file mode 100644
index 0000000..bcacfcb
--- /dev/null
+++ b/Source/MAX.Core/DependencyInjection/ISingletonDependency.cs
@@ -0,0 +1,8 @@
+namespace MAX.Core.DependencyInjection;
+
+///
+/// 单例
+///
+public interface ISingletonDependency
+{
+}
diff --git a/Source/MAX.Core/DependencyInjection/ITransientDependency.cs b/Source/MAX.Core/DependencyInjection/ITransientDependency.cs
new file mode 100644
index 0000000..3da15a0
--- /dev/null
+++ b/Source/MAX.Core/DependencyInjection/ITransientDependency.cs
@@ -0,0 +1,8 @@
+namespace MAX.Core.DependencyInjection;
+
+///
+/// 每次实例化
+///
+public interface ITransientDependency
+{
+}
diff --git a/Source/MAX.Core/DependencyInjection/LazyServiceProvider.cs b/Source/MAX.Core/DependencyInjection/LazyServiceProvider.cs
new file mode 100644
index 0000000..2429709
--- /dev/null
+++ b/Source/MAX.Core/DependencyInjection/LazyServiceProvider.cs
@@ -0,0 +1,36 @@
+using MAX.Core.Infrastructure;
+using System;
+using System.Collections.Concurrent;
+
+namespace MAX.Core.DependencyInjection;
+
+public interface ILazyServiceProvider
+{
+ object LazyGetService(Type serviceType);
+ T LazyGetService();
+}
+
+public class LazyServiceProvider : SingleInstance, ILazyServiceProvider
+{
+ protected ConcurrentDictionary> CachedServices { get; }
+ private LazyServiceProvider()
+ {
+ CachedServices = new ConcurrentDictionary>();
+ }
+ public virtual T LazyGetService()
+ {
+ return (T)LazyGetService(typeof(T));
+ }
+
+ public virtual object LazyGetService(Type serviceType)
+ {
+ return GetService(serviceType);
+ }
+ public virtual object GetService(Type serviceType)
+ {
+ return CachedServices.GetOrAdd(
+ serviceType,
+ _ => new Lazy