diff --git a/HybirdFrameworkRepository/HybirdFrameworkRepository.csproj b/HybirdFrameworkRepository/HybirdFrameworkRepository.csproj index e756aee..c7d82a5 100644 --- a/HybirdFrameworkRepository/HybirdFrameworkRepository.csproj +++ b/HybirdFrameworkRepository/HybirdFrameworkRepository.csproj @@ -12,6 +12,7 @@ + diff --git a/HybirdFrameworkRepository/System/SysUserRepository.cs b/HybirdFrameworkRepository/System/SysUserRepository.cs index 0c7f93c..9a9c0e6 100644 --- a/HybirdFrameworkRepository/System/SysUserRepository.cs +++ b/HybirdFrameworkRepository/System/SysUserRepository.cs @@ -1,9 +1,11 @@ -using HybirdFrameworkEntity.DbModel; +using HybirdFrameworkCore.Autofac.Attribute; +using HybirdFrameworkEntity.DbModel; using SqlSugar; namespace HybirdFrameworkRepository.System { + [Scope("SingleInstance")] public class SysUserRepository : BaseRepository { public SysUserRepository(ISqlSugarClient sqlSugar) : base(sqlSugar) diff --git a/HybirdFrameworkRepository/UnitOfWork/UnitOfWork.cs b/HybirdFrameworkRepository/UnitOfWork/UnitOfWork.cs index 5c35e52..40a98b4 100644 --- a/HybirdFrameworkRepository/UnitOfWork/UnitOfWork.cs +++ b/HybirdFrameworkRepository/UnitOfWork/UnitOfWork.cs @@ -1,7 +1,9 @@ -using SqlSugar; +using HybirdFrameworkCore.Autofac.Attribute; +using SqlSugar; namespace HybirdFrameworkRepository.UnitOfWork { + [Scope("SingleInstance")] public class UnitOfWork { private readonly ISqlSugarClient _sqlSugarClient; diff --git a/HybirdFrameworkRepository/bin/Debug/net6.0/HybirdFrameworkRepository.deps.json b/HybirdFrameworkRepository/bin/Debug/net6.0/HybirdFrameworkRepository.deps.json index 35b2840..e543d05 100644 --- a/HybirdFrameworkRepository/bin/Debug/net6.0/HybirdFrameworkRepository.deps.json +++ b/HybirdFrameworkRepository/bin/Debug/net6.0/HybirdFrameworkRepository.deps.json @@ -8,6 +8,7 @@ ".NETCoreApp,Version=v6.0": { "HybirdFrameworkRepository/1.0.0": { "dependencies": { + "HybirdFrameworkCore": "1.0.0", "HybirdFrameworkEntity": "1.0.0", "SqlSugar.IOC": "2.0.0", "SqlSugarCore": "5.1.4.95" @@ -16,6 +17,28 @@ "HybirdFrameworkRepository.dll": {} } }, + "Autofac/7.0.1": { + "dependencies": { + "System.Diagnostics.DiagnosticSource": "4.7.1" + }, + "runtime": { + "lib/net6.0/Autofac.dll": { + "assemblyVersion": "7.0.1.0", + "fileVersion": "7.0.1.0" + } + } + }, + "log4net/2.0.15": { + "dependencies": { + "System.Configuration.ConfigurationManager": "6.0.0" + }, + "runtime": { + "lib/netstandard2.0/log4net.dll": { + "assemblyVersion": "2.0.15.0", + "fileVersion": "2.0.15.0" + } + } + }, "Microsoft.CSharp/4.5.0": {}, "Microsoft.Data.SqlClient/2.1.4": { "dependencies": { @@ -25,7 +48,7 @@ "Microsoft.IdentityModel.Protocols.OpenIdConnect": "6.8.0", "Microsoft.Win32.Registry": "4.7.0", "System.Configuration.ConfigurationManager": "6.0.0", - "System.Diagnostics.DiagnosticSource": "4.7.0", + "System.Diagnostics.DiagnosticSource": "4.7.1", "System.Runtime.Caching": "4.7.0", "System.Security.Principal.Windows": "4.7.0", "System.Text.Encoding.CodePages": "5.0.0" @@ -92,6 +115,59 @@ } } }, + "Microsoft.Extensions.Configuration/7.0.0": { + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", + "Microsoft.Extensions.Primitives": "7.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.Configuration.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "Microsoft.Extensions.Configuration.Abstractions/7.0.0": { + "dependencies": { + "Microsoft.Extensions.Primitives": "7.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.Configuration.Abstractions.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "Microsoft.Extensions.Configuration.FileExtensions/7.0.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "7.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "7.0.0", + "Microsoft.Extensions.FileProviders.Physical": "7.0.0", + "Microsoft.Extensions.Primitives": "7.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.Configuration.FileExtensions.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "Microsoft.Extensions.Configuration.Json/7.0.0": { + "dependencies": { + "Microsoft.Extensions.Configuration": "7.0.0", + "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", + "Microsoft.Extensions.Configuration.FileExtensions": "7.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "7.0.0", + "System.Text.Json": "7.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.Configuration.Json.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, "Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": { "runtime": { "lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": { @@ -100,6 +176,49 @@ } } }, + "Microsoft.Extensions.FileProviders.Abstractions/7.0.0": { + "dependencies": { + "Microsoft.Extensions.Primitives": "7.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.FileProviders.Abstractions.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "Microsoft.Extensions.FileProviders.Physical/7.0.0": { + "dependencies": { + "Microsoft.Extensions.FileProviders.Abstractions": "7.0.0", + "Microsoft.Extensions.FileSystemGlobbing": "7.0.0", + "Microsoft.Extensions.Primitives": "7.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.FileProviders.Physical.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "Microsoft.Extensions.FileSystemGlobbing/7.0.0": { + "runtime": { + "lib/net6.0/Microsoft.Extensions.FileSystemGlobbing.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "Microsoft.Extensions.Primitives/7.0.0": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + }, + "runtime": { + "lib/net6.0/Microsoft.Extensions.Primitives.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, "Microsoft.Identity.Client/4.21.1": { "runtime": { "lib/netcoreapp2.1/Microsoft.Identity.Client.dll": { @@ -196,17 +315,17 @@ } } }, - "Newtonsoft.Json/13.0.2": { + "Newtonsoft.Json/13.0.3": { "runtime": { "lib/net6.0/Newtonsoft.Json.dll": { "assemblyVersion": "13.0.0.0", - "fileVersion": "13.0.2.27524" + "fileVersion": "13.0.3.27908" } } }, "Npgsql/5.0.7": { "dependencies": { - "System.Runtime.CompilerServices.Unsafe": "4.6.0" + "System.Runtime.CompilerServices.Unsafe": "6.0.0" }, "runtime": { "lib/net5.0/Npgsql.dll": { @@ -398,7 +517,7 @@ "Microsoft.Data.SqlClient": "2.1.4", "Microsoft.Data.Sqlite": "7.0.5", "MySqlConnector": "2.2.5", - "Newtonsoft.Json": "13.0.2", + "Newtonsoft.Json": "13.0.3", "Npgsql": "5.0.7", "Oracle.ManagedDataAccess.Core": "3.21.100", "SqlSugarCore.Dm": "1.2.0", @@ -463,7 +582,7 @@ "System.Threading.Tasks": "4.3.0" } }, - "System.Diagnostics.DiagnosticSource/4.7.0": {}, + "System.Diagnostics.DiagnosticSource/4.7.1": {}, "System.Diagnostics.PerformanceCounter/6.0.1": { "dependencies": { "System.Configuration.ConfigurationManager": "6.0.0" @@ -650,7 +769,7 @@ } } }, - "System.Runtime.CompilerServices.Unsafe/4.6.0": {}, + "System.Runtime.CompilerServices.Unsafe/6.0.0": {}, "System.Runtime.Extensions/4.3.0": { "dependencies": { "Microsoft.NETCore.Platforms": "5.0.0", @@ -708,6 +827,37 @@ "Microsoft.NETCore.Platforms": "5.0.0" } }, + "System.Text.Encodings.Web/7.0.0": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + }, + "runtime": { + "lib/net6.0/System.Text.Encodings.Web.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + }, + "runtimeTargets": { + "runtimes/browser/lib/net6.0/System.Text.Encodings.Web.dll": { + "rid": "browser", + "assetType": "runtime", + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, + "System.Text.Json/7.0.0": { + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "7.0.0" + }, + "runtime": { + "lib/net6.0/System.Text.Json.dll": { + "assemblyVersion": "7.0.0.0", + "fileVersion": "7.0.22.51805" + } + } + }, "System.Text.RegularExpressions/4.3.0": { "dependencies": { "System.Runtime": "4.3.0" @@ -739,6 +889,18 @@ } } }, + "HybirdFrameworkCore/1.0.0": { + "dependencies": { + "Autofac": "7.0.1", + "Microsoft.Extensions.Configuration.Abstractions": "7.0.0", + "Microsoft.Extensions.Configuration.Json": "7.0.0", + "Newtonsoft.Json": "13.0.3", + "log4net": "2.0.15" + }, + "runtime": { + "HybirdFrameworkCore.dll": {} + } + }, "HybirdFrameworkEntity/1.0.0": { "dependencies": { "SqlSugarCore": "5.1.4.95" @@ -755,6 +917,20 @@ "serviceable": false, "sha512": "" }, + "Autofac/7.0.1": { + "type": "package", + "serviceable": true, + "sha512": "sha512-J9Iz0Q+YU3uf82i8Lee0NpQOlRYfwHxwVV26jdG3zH3LFE5Y9Rx97Mju7Nswwzh/C7kVJALkTL860Y7e+mcLaw==", + "path": "autofac/7.0.1", + "hashPath": "autofac.7.0.1.nupkg.sha512" + }, + "log4net/2.0.15": { + "type": "package", + "serviceable": true, + "sha512": "sha512-GahnO9ZgFka+xYcFwAfIFjW+k86P2nxFoaEpH6t3v4hiGj7tv2ksVZphxCVIHmJxoySS0HeU3dgCW+bSCcfD0A==", + "path": "log4net/2.0.15", + "hashPath": "log4net.2.0.15.nupkg.sha512" + }, "Microsoft.CSharp/4.5.0": { "type": "package", "serviceable": true, @@ -790,6 +966,34 @@ "path": "microsoft.data.sqlite.core/7.0.5", "hashPath": "microsoft.data.sqlite.core.7.0.5.nupkg.sha512" }, + "Microsoft.Extensions.Configuration/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-tldQUBWt/xeH2K7/hMPPo5g8zuLc3Ro9I5d4o/XrxvxOCA2EZBtW7bCHHTc49fcBtvB8tLAb/Qsmfrq+2SJ4vA==", + "path": "microsoft.extensions.configuration/7.0.0", + "hashPath": "microsoft.extensions.configuration.7.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.Abstractions/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-f34u2eaqIjNO9YLHBz8rozVZ+TcFiFs0F3r7nUJd7FRkVSxk8u4OpoK226mi49MwexHOR2ibP9MFvRUaLilcQQ==", + "path": "microsoft.extensions.configuration.abstractions/7.0.0", + "hashPath": "microsoft.extensions.configuration.abstractions.7.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.FileExtensions/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-xk2lRJ1RDuqe57BmgvRPyCt6zyePKUmvT6iuXqiHR+/OIIgWVR8Ff5k2p6DwmqY8a17hx/OnrekEhziEIeQP6Q==", + "path": "microsoft.extensions.configuration.fileextensions/7.0.0", + "hashPath": "microsoft.extensions.configuration.fileextensions.7.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.Configuration.Json/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-LDNYe3uw76W35Jci+be4LDf2lkQZe0A7EEYQVChFbc509CpZ4Iupod8li4PUXPBhEUOFI/rlQNf5xkzJRQGvtA==", + "path": "microsoft.extensions.configuration.json/7.0.0", + "hashPath": "microsoft.extensions.configuration.json.7.0.0.nupkg.sha512" + }, "Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": { "type": "package", "serviceable": true, @@ -797,6 +1001,34 @@ "path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0", "hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512" }, + "Microsoft.Extensions.FileProviders.Abstractions/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-NyawiW9ZT/liQb34k9YqBSNPLuuPkrjMgQZ24Y/xXX1RoiBkLUdPMaQTmxhZ5TYu8ZKZ9qayzil75JX95vGQUg==", + "path": "microsoft.extensions.fileproviders.abstractions/7.0.0", + "hashPath": "microsoft.extensions.fileproviders.abstractions.7.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.FileProviders.Physical/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-K8D2MTR+EtzkbZ8z80LrG7Ur64R7ZZdRLt1J5cgpc/pUWl0C6IkAUapPuK28oionHueCPELUqq0oYEvZfalNdg==", + "path": "microsoft.extensions.fileproviders.physical/7.0.0", + "hashPath": "microsoft.extensions.fileproviders.physical.7.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.FileSystemGlobbing/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-2jONjKHiF+E92ynz2ZFcr9OvxIw+rTGMPEH+UZGeHTEComVav93jQUWGkso8yWwVBcEJGcNcZAaqY01FFJcj7w==", + "path": "microsoft.extensions.filesystemglobbing/7.0.0", + "hashPath": "microsoft.extensions.filesystemglobbing.7.0.0.nupkg.sha512" + }, + "Microsoft.Extensions.Primitives/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-um1KU5kxcRp3CNuI8o/GrZtD4AIOXDk+RLsytjZ9QPok3ttLUelLKpilVPuaFT3TFjOhSibUAso0odbOaCDj3Q==", + "path": "microsoft.extensions.primitives/7.0.0", + "hashPath": "microsoft.extensions.primitives.7.0.0.nupkg.sha512" + }, "Microsoft.Identity.Client/4.21.1": { "type": "package", "serviceable": true, @@ -874,12 +1106,12 @@ "path": "mysqlconnector/2.2.5", "hashPath": "mysqlconnector.2.2.5.nupkg.sha512" }, - "Newtonsoft.Json/13.0.2": { + "Newtonsoft.Json/13.0.3": { "type": "package", "serviceable": true, - "sha512": "sha512-R2pZ3B0UjeyHShm9vG+Tu0EBb2lC8b0dFzV9gVn50ofHXh9Smjk6kTn7A/FdAsC8B5cKib1OnGYOXxRBz5XQDg==", - "path": "newtonsoft.json/13.0.2", - "hashPath": "newtonsoft.json.13.0.2.nupkg.sha512" + "sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==", + "path": "newtonsoft.json/13.0.3", + "hashPath": "newtonsoft.json.13.0.3.nupkg.sha512" }, "Npgsql/5.0.7": { "type": "package", @@ -972,12 +1204,12 @@ "path": "system.data.common/4.3.0", "hashPath": "system.data.common.4.3.0.nupkg.sha512" }, - "System.Diagnostics.DiagnosticSource/4.7.0": { + "System.Diagnostics.DiagnosticSource/4.7.1": { "type": "package", "serviceable": true, - "sha512": "sha512-oJjw3uFuVDJiJNbCD8HB4a2p3NYLdt1fiT5OGsPLw+WTOuG0KpP4OXelMmmVKpClueMsit6xOlzy4wNKQFiBLg==", - "path": "system.diagnostics.diagnosticsource/4.7.0", - "hashPath": "system.diagnostics.diagnosticsource.4.7.0.nupkg.sha512" + "sha512": "sha512-j81Lovt90PDAq8kLpaJfJKV/rWdWuEk6jfV+MBkee33vzYLEUsy4gXK8laa9V2nZlLM9VM9yA/OOQxxPEJKAMw==", + "path": "system.diagnostics.diagnosticsource/4.7.1", + "hashPath": "system.diagnostics.diagnosticsource.4.7.1.nupkg.sha512" }, "System.Diagnostics.PerformanceCounter/6.0.1": { "type": "package", @@ -1084,12 +1316,12 @@ "path": "system.runtime.caching/4.7.0", "hashPath": "system.runtime.caching.4.7.0.nupkg.sha512" }, - "System.Runtime.CompilerServices.Unsafe/4.6.0": { + "System.Runtime.CompilerServices.Unsafe/6.0.0": { "type": "package", "serviceable": true, - "sha512": "sha512-HxozeSlipUK7dAroTYwIcGwKDeOVpQnJlpVaOkBz7CM4TsE5b/tKlQBZecTjh6FzcSbxndYaxxpsBMz+wMJeyw==", - "path": "system.runtime.compilerservices.unsafe/4.6.0", - "hashPath": "system.runtime.compilerservices.unsafe.4.6.0.nupkg.sha512" + "sha512": "sha512-/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==", + "path": "system.runtime.compilerservices.unsafe/6.0.0", + "hashPath": "system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512" }, "System.Runtime.Extensions/4.3.0": { "type": "package", @@ -1154,6 +1386,20 @@ "path": "system.text.encoding.codepages/5.0.0", "hashPath": "system.text.encoding.codepages.5.0.0.nupkg.sha512" }, + "System.Text.Encodings.Web/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", + "path": "system.text.encodings.web/7.0.0", + "hashPath": "system.text.encodings.web.7.0.0.nupkg.sha512" + }, + "System.Text.Json/7.0.0": { + "type": "package", + "serviceable": true, + "sha512": "sha512-DaGSsVqKsn/ia6RG8frjwmJonfos0srquhw09TlT8KRw5I43E+4gs+/bZj4K0vShJ5H9imCuXupb4RmS+dBy3w==", + "path": "system.text.json/7.0.0", + "hashPath": "system.text.json.7.0.0.nupkg.sha512" + }, "System.Text.RegularExpressions/4.3.0": { "type": "package", "serviceable": true, @@ -1175,6 +1421,11 @@ "path": "system.windows.extensions/6.0.0", "hashPath": "system.windows.extensions.6.0.0.nupkg.sha512" }, + "HybirdFrameworkCore/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + }, "HybirdFrameworkEntity/1.0.0": { "type": "project", "serviceable": false, diff --git a/HybirdFrameworkRepository/obj/Debug/net6.0/ref/HybirdFrameworkRepository.dll b/HybirdFrameworkRepository/obj/Debug/net6.0/ref/HybirdFrameworkRepository.dll index 76ccfbb..6d7c9c8 100644 Binary files a/HybirdFrameworkRepository/obj/Debug/net6.0/ref/HybirdFrameworkRepository.dll and b/HybirdFrameworkRepository/obj/Debug/net6.0/ref/HybirdFrameworkRepository.dll differ diff --git a/HybirdFrameworkRepository/obj/Debug/net6.0/refint/HybirdFrameworkRepository.dll b/HybirdFrameworkRepository/obj/Debug/net6.0/refint/HybirdFrameworkRepository.dll index 76ccfbb..6d7c9c8 100644 Binary files a/HybirdFrameworkRepository/obj/Debug/net6.0/refint/HybirdFrameworkRepository.dll and b/HybirdFrameworkRepository/obj/Debug/net6.0/refint/HybirdFrameworkRepository.dll differ diff --git a/HybirdFrameworkRepository/obj/HybirdFrameworkRepository.csproj.nuget.g.targets b/HybirdFrameworkRepository/obj/HybirdFrameworkRepository.csproj.nuget.g.targets index 8861a95..6a3c0bd 100644 --- a/HybirdFrameworkRepository/obj/HybirdFrameworkRepository.csproj.nuget.g.targets +++ b/HybirdFrameworkRepository/obj/HybirdFrameworkRepository.csproj.nuget.g.targets @@ -1,6 +1,7 @@  + \ No newline at end of file diff --git a/HybirdFrameworkServices/System/SysUserServices.cs b/HybirdFrameworkServices/System/SysUserServices.cs index bd29278..8663fb1 100644 --- a/HybirdFrameworkServices/System/SysUserServices.cs +++ b/HybirdFrameworkServices/System/SysUserServices.cs @@ -1,9 +1,11 @@ -using HybirdFrameworkEntity.DbModel; +using HybirdFrameworkCore.Autofac.Attribute; +using HybirdFrameworkEntity.DbModel; using HybirdFrameworkRepository.System; using HybirdFrameworkRepository.UnitOfWork; namespace HybirdFrameworkServices.System { + [Scope("SingleInstance")] public class SysUserServices : BaseServices { private readonly SysUserRepository _dal; diff --git a/WpfStarter/App.xaml b/WpfStarter/App.xaml new file mode 100644 index 0000000..9adb9a3 --- /dev/null +++ b/WpfStarter/App.xaml @@ -0,0 +1,8 @@ + + + + + diff --git a/WpfStarter/App.xaml.cs b/WpfStarter/App.xaml.cs new file mode 100644 index 0000000..6974958 --- /dev/null +++ b/WpfStarter/App.xaml.cs @@ -0,0 +1,54 @@ +using System.Windows; +using Autofac; +using HybirdFrameworkCore.Autofac; +using HybirdFrameworkCore.Configuration; +using SqlSugar; +using SqlSugar.IOC; + +namespace WpfStarter +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + public App() + { + ContainerBuilder cb = new ContainerBuilder(); + cb.Register(c => + { + var db = new SqlSugarClient(new ConnectionConfig + { + ConfigId = AppSettingsConstVars.ConfigId, + ConnectionString = AppSettingsConstVars.DbSqlConnection, // 设置数据库连接字符串 + DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() + ? DbType.MySql + : DbType.SqlServer, + IsAutoCloseConnection = true, + InitKeyType = InitKeyType.Attribute // 如果使用实体类的属性进行主键标识,请设置为 InitKeyType.Attribute + }); + return db; + }).As().InstancePerLifetimeScope(); + + cb.RegisterModule(new AutofacModuleRegister()); + + var baseType = typeof(Window); + cb.RegisterAssemblyTypes(typeof(App).Assembly) + .Where(t => baseType.IsAssignableFrom(t) && t != baseType) + .InstancePerDependency(); + + // cb.RegisterType(typeof(MainWindow)).SingleInstance(); + + // 构建容器 + var Container = cb.Build(); + AppInfo.Container = Container.BeginLifetimeScope("root"); + } + + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + MainWindow mainWindow = AppInfo.Container.Resolve(); + mainWindow.Show(); + } + } +} \ No newline at end of file diff --git a/WpfStarter/AssemblyInfo.cs b/WpfStarter/AssemblyInfo.cs new file mode 100644 index 0000000..4a05c7d --- /dev/null +++ b/WpfStarter/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) +)] \ No newline at end of file diff --git a/WpfStarter/MainWindow.xaml b/WpfStarter/MainWindow.xaml new file mode 100644 index 0000000..dbe325b --- /dev/null +++ b/WpfStarter/MainWindow.xaml @@ -0,0 +1,13 @@ + + + + + + diff --git a/WpfStarter/MainWindow.xaml.cs b/WpfStarter/MainWindow.xaml.cs new file mode 100644 index 0000000..3a2ad63 --- /dev/null +++ b/WpfStarter/MainWindow.xaml.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Windows; +using Autofac; +using HybirdFrameworkCore.Autofac; +using HybirdFrameworkEntity.DbModel; +using HybirdFrameworkServices.System; +using log4net; + +namespace WpfStarter +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + private static readonly ILog Log = LogManager.GetLogger(typeof(MainWindow)); + + private SysUserServices _sysUserServices; + + public MainWindow() + { + InitializeComponent(); + _sysUserServices = AppInfo.Container.Resolve(); + } + + private void TestClick(object sender, RoutedEventArgs e) + { + List sysUsers = _sysUserServices.Query(); + MessageBox.Show($"count={sysUsers.Count}"); + Log.Info($"count={sysUsers.Count}"); + } + } +} \ No newline at end of file diff --git a/WpfStarter/WpfStarter.csproj b/WpfStarter/WpfStarter.csproj new file mode 100644 index 0000000..4f1a594 --- /dev/null +++ b/WpfStarter/WpfStarter.csproj @@ -0,0 +1,35 @@ + + + + WinExe + net6.0-windows + enable + true + + + + + + + + + + + + + Always + + + Always + + + + + + + + + + + + diff --git a/WpfStarter/appsettings.json b/WpfStarter/appsettings.json new file mode 100644 index 0000000..213c6d6 --- /dev/null +++ b/WpfStarter/appsettings.json @@ -0,0 +1,18 @@ +{ + "ConnectionStrings": { + "DbType": "MySql", //数据库将支持两种模式【SqlServer,MySql】 + "SqlConnection": "server=127.0.0.1;Port=3307;Database=winformdevframework;Uid=root;Pwd=w123ee;Charset=utf8;" + }, + "Update": { + "AutoUpdate": "false", + "Version": "1.1.0.1", + "Url": "http://121.4.95.243:8090/Updates/AutoUpdaterStarter.xml"//更新服务器地址 + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} \ No newline at end of file diff --git a/WpfStarter/log4net.xml b/WpfStarter/log4net.xml new file mode 100644 index 0000000..e4ee0a2 --- /dev/null +++ b/WpfStarter/log4net.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hybirdMyFrame.sln b/hybirdMyFrame.sln index 4d13104..9542d02 100644 --- a/hybirdMyFrame.sln +++ b/hybirdMyFrame.sln @@ -11,10 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HybirdFramework.Repository" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HybirdFramework.Services", "HybirdFramework.Services", "{5F67ED42-6437-4FC6-86D2-0495DE990BC4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebStart", "WebStart", "{DEE625EC-B6DC-4381-B78C-D89F09C00E7C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WinformStart", "WinformStart", "{A0BA21DB-6630-41AB-A0FD-594DBB197E0E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebStarter", "WebStarter\WebStarter.csproj", "{61B1609B-97EE-48E4-ADA6-4F1A832B8D33}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HybirdFrameworkCore", "HybirdFrameworkCore\HybirdFrameworkCore.csproj", "{5F1D9B39-E50F-4B7C-B1C6-E60B64C4CA1A}" @@ -35,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleStarter", "ConsoleSt EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Starter", "Starter", "{E0B949DC-17FE-414D-8898-937A317BB853}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfStarter", "WpfStarter\WpfStarter.csproj", "{17044C11-3794-4938-BA80-C061BD871AE0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,19 +71,24 @@ Global {8EAFC092-1C8A-4CF7-B283-FFCB02D58ED8}.Debug|Any CPU.Build.0 = Debug|Any CPU {8EAFC092-1C8A-4CF7-B283-FFCB02D58ED8}.Release|Any CPU.ActiveCfg = Release|Any CPU {8EAFC092-1C8A-4CF7-B283-FFCB02D58ED8}.Release|Any CPU.Build.0 = Release|Any CPU + {17044C11-3794-4938-BA80-C061BD871AE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {17044C11-3794-4938-BA80-C061BD871AE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {17044C11-3794-4938-BA80-C061BD871AE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {17044C11-3794-4938-BA80-C061BD871AE0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {61B1609B-97EE-48E4-ADA6-4F1A832B8D33} = {DEE625EC-B6DC-4381-B78C-D89F09C00E7C} {5F1D9B39-E50F-4B7C-B1C6-E60B64C4CA1A} = {0E784680-8280-4C47-8D2D-6405AC892164} {01D2CC15-F1FD-4E22-845A-2D2473662860} = {348F9459-2A59-47EB-B801-0CF907DFD8EC} {A6C2AA7F-B2A2-4AE0-AE84-49BE36B990EC} = {5F67ED42-6437-4FC6-86D2-0495DE990BC4} - {A6757DAD-EF5A-41FD-9323-F3FCF05ED777} = {A0BA21DB-6630-41AB-A0FD-594DBB197E0E} {C2380814-15D4-491D-ADF2-ADC68617C3FA} = {6203689E-8261-4814-BFC2-013188AED6A1} {6ACFA707-E72E-4BA1-8262-9F2E5B758D46} = {EF6B2DEC-ADAA-4A6D-AE93-0F98A555B265} {8EAFC092-1C8A-4CF7-B283-FFCB02D58ED8} = {E0B949DC-17FE-414D-8898-937A317BB853} + {17044C11-3794-4938-BA80-C061BD871AE0} = {E0B949DC-17FE-414D-8898-937A317BB853} + {61B1609B-97EE-48E4-ADA6-4F1A832B8D33} = {E0B949DC-17FE-414D-8898-937A317BB853} + {A6757DAD-EF5A-41FD-9323-F3FCF05ED777} = {E0B949DC-17FE-414D-8898-937A317BB853} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3E10BF3D-9914-44B1-A6AA-FCF013C3F155}