wpf集成Autofac和Sqlsugar

master
smartwyy 7 months ago
parent 1634a07759
commit 500d02286c

@ -12,6 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HybirdFrameworkCore\HybirdFrameworkCore.csproj" />
<ProjectReference Include="..\HybirdFrameworkEntity\HybirdFrameworkEntity.csproj" />
</ItemGroup>

@ -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<sysUser>
{
public SysUserRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)

@ -1,7 +1,9 @@
using SqlSugar;
using HybirdFrameworkCore.Autofac.Attribute;
using SqlSugar;
namespace HybirdFrameworkRepository.UnitOfWork
{
[Scope("SingleInstance")]
public class UnitOfWork
{
private readonly ISqlSugarClient _sqlSugarClient;

@ -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,

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)system.text.json\7.0.0\buildTransitive\net6.0\System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json\7.0.0\buildTransitive\net6.0\System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)sqlitepclraw.lib.e_sqlite3\2.1.4\buildTransitive\net6.0\SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('$(NuGetPackageRoot)sqlitepclraw.lib.e_sqlite3\2.1.4\buildTransitive\net6.0\SQLitePCLRaw.lib.e_sqlite3.targets')" />
</ImportGroup>
</Project>

@ -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<sysUser>
{
private readonly SysUserRepository _dal;

@ -0,0 +1,8 @@
<Application x:Class="WpfStarter.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfStarter" >
<Application.Resources>
</Application.Resources>
</Application>

@ -0,0 +1,54 @@
using System.Windows;
using Autofac;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using SqlSugar;
using SqlSugar.IOC;
namespace WpfStarter
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
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<ISqlSugarClient>().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>();
mainWindow.Show();
}
}
}

@ -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)
)]

@ -0,0 +1,13 @@
<Window x:Class="WpfStarter.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfStarter"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Content="测试" Click="TestClick"></Button>
</Grid>
</Window>

@ -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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private static readonly ILog Log = LogManager.GetLogger(typeof(MainWindow));
private SysUserServices _sysUserServices;
public MainWindow()
{
InitializeComponent();
_sysUserServices = AppInfo.Container.Resolve<SysUserServices>();
}
private void TestClick(object sender, RoutedEventArgs e)
{
List<sysUser> sysUsers = _sysUserServices.Query();
MessageBox.Show($"count={sysUsers.Count}");
Log.Info($"count={sysUsers.Count}");
}
}
}

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="7.1.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.95" />
</ItemGroup>
<ItemGroup>
<None Update="log4net.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HybirdFrameworkCore\HybirdFrameworkCore.csproj" />
<ProjectReference Include="..\HybirdFrameworkDriver\HybirdFrameworkDriver.csproj" />
<ProjectReference Include="..\HybirdFrameworkEntity\HybirdFrameworkEntity.csproj" />
<ProjectReference Include="..\HybirdFrameworkRepository\HybirdFrameworkRepository.csproj" />
<ProjectReference Include="..\HybirdFrameworkServices\HybirdFrameworkServices.csproj" />
</ItemGroup>
</Project>

@ -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"
}
}
}

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<log4net>
<!-- 控制台日志配置 -->
<appender name="Console" type="log4net.Appender.ConsoleAppender">
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %5level [%thread] (%file:%line) - %message%newline" />
</layout>
</appender>
<!-- 文件存储日志配置 -->
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<!-- 保存文件的名称 -->
<file value="logs\Wpf.log" />
<appendToFile value="true" />
<!-- 文件的编码方式 -->
<param name="Encoding" value="UTF-8"/>
<!-- 每个文件的大小 -->
<maximumFileSize value="100MB" />
<!-- 保存文件数量 -->
<maxSizeRollBackups value="2" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<!-- 日志输出格式 -->
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level %thread %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" />
</root>
</log4net>

@ -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}

Loading…
Cancel
Save