├── .dockerignore ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── -----.md │ └── --bug.md └── workflows │ ├── ci.yml │ ├── nuget.yml │ └── osharp_docs.yml ├── .gitignore ├── LICENSE ├── OSharpNS.nuspec ├── README.md ├── build ├── OSharp.Keys.snk ├── OSharpNS.nuspec ├── apicleaner.exe ├── docs-build.bat ├── icon.png ├── nuget-build.ps1 ├── nuget-delete.ps1 ├── nuget-push.ps1 ├── nuget.exe ├── public.props ├── version.props └── 示例项目[Liuliu.Demo].json ├── docs ├── .editorconfig ├── .vscode │ └── settings.json ├── Dockerfile ├── build.ps1 ├── docker │ ├── Dockerfile │ └── build.ps1 ├── docs │ ├── .pages │ ├── about │ │ ├── .pages │ │ ├── index.md │ │ ├── licence.md │ │ └── update-logs.md │ ├── assets │ │ ├── css │ │ │ └── custom.css │ │ ├── favicon.ico │ │ ├── imgs │ │ │ ├── 01.jpg │ │ │ └── quick │ │ │ │ ├── identity │ │ │ │ └── jwt │ │ │ │ │ └── jwt-refresh.png │ │ │ │ ├── intro │ │ │ │ ├── 001.png │ │ │ │ ├── 002.png │ │ │ │ ├── 003.png │ │ │ │ ├── 004.png │ │ │ │ ├── 005.png │ │ │ │ └── 006.png │ │ │ │ ├── start │ │ │ │ ├── 001.gif │ │ │ │ ├── 002.png │ │ │ │ ├── 003.png │ │ │ │ ├── 004.png │ │ │ │ ├── 005.png │ │ │ │ ├── 006.png │ │ │ │ ├── 007.png │ │ │ │ └── 008.png │ │ │ │ └── steps │ │ │ │ ├── controller │ │ │ │ ├── 001.png │ │ │ │ ├── 002.png │ │ │ │ ├── 003.png │ │ │ │ ├── 004.png │ │ │ │ ├── 005.png │ │ │ │ ├── 006.png │ │ │ │ ├── 007.png │ │ │ │ ├── 008.png │ │ │ │ ├── 009.png │ │ │ │ ├── 010.png │ │ │ │ ├── 011.png │ │ │ │ ├── 012.png │ │ │ │ ├── 013.png │ │ │ │ └── 014.png │ │ │ │ ├── entity │ │ │ │ ├── 001.png │ │ │ │ └── 002.png │ │ │ │ ├── ng-module │ │ │ │ ├── 001.gif │ │ │ │ ├── 002.gif │ │ │ │ ├── 003.gif │ │ │ │ ├── 004.gif │ │ │ │ ├── 10days.png │ │ │ │ └── 11user.png │ │ │ │ └── service │ │ │ │ └── 001.png │ │ ├── js │ │ │ ├── custom.js │ │ │ └── jquery.min.js │ │ └── logo.svg │ ├── explain │ │ ├── .pages │ │ ├── index.md │ │ ├── overall-design.md │ │ ├── packs │ │ │ ├── .pages │ │ │ ├── aspnetcore-mvc.md │ │ │ ├── aspnetcore.md │ │ │ ├── auth │ │ │ │ ├── .pages │ │ │ │ ├── data-auth.md │ │ │ │ ├── function-auth.md │ │ │ │ └── index.md │ │ │ ├── automapper.md │ │ │ ├── core.md │ │ │ ├── dependency.md │ │ │ ├── efcore │ │ │ │ ├── .pages │ │ │ │ ├── database-provider.md │ │ │ │ ├── dbcontext.md │ │ │ │ ├── entity-repository.md │ │ │ │ ├── index.md │ │ │ │ ├── migration.md │ │ │ │ └── unitofwork-transaction.md │ │ │ ├── entityinfo.md │ │ │ ├── eventbus.md │ │ │ ├── hangfire.md │ │ │ ├── identity.md │ │ │ ├── index.md │ │ │ ├── mvc-function.md │ │ │ ├── redis.md │ │ │ └── signalr.md │ │ ├── services │ │ │ ├── caching.md │ │ │ └── filter.md │ │ └── startup.md │ ├── faq │ │ └── index.md │ ├── index.md │ ├── issue │ │ ├── 主从数据库(读写分离)设计.md │ │ └── 简化UnitOfWork的设计,整合UnitOfWorkManager.md │ ├── quick │ │ ├── .pages │ │ ├── generator.md │ │ ├── intro.md │ │ ├── permiss │ │ │ ├── .pages │ │ │ ├── function-entityinfo-module.md │ │ │ ├── index.md │ │ │ ├── role-entityinfo.md │ │ │ ├── role.md │ │ │ └── user.md │ │ ├── start.md │ │ └── steps │ │ │ ├── .pages │ │ │ ├── controller.md │ │ │ ├── entity.md │ │ │ ├── index.md │ │ │ ├── ng-module.md │ │ │ └── service.md │ └── video │ │ └── index.md └── mkdocs.yml ├── global.json ├── osharp.sln ├── osharp.sln.DotSettings ├── samples ├── web │ ├── .editorconfig │ ├── Liuliu.Demo.Core │ │ ├── Authorization │ │ │ ├── DataAuthCache.cs │ │ │ ├── DataAuthManager.cs │ │ │ ├── DataAuthorizationPack.cs │ │ │ ├── Dtos │ │ │ │ ├── AutoMapperConfiguration.cs │ │ │ │ ├── EntityInfoNode.cs │ │ │ │ ├── EntityInfoOutputDto.cs │ │ │ │ ├── EntityRoleInputDto.cs │ │ │ │ ├── EntityRoleOutputDto.cs │ │ │ │ ├── FunctionOutputDto.cs │ │ │ │ ├── FunctionOutputDto2.cs │ │ │ │ ├── ModuleInputDto.cs │ │ │ │ ├── ModuleOutputDto.cs │ │ │ │ ├── ModuleSetFunctionDto.cs │ │ │ │ ├── RoleSetModuleDto.cs │ │ │ │ ├── UserSetModuleDto.cs │ │ │ │ └── UserSetRoleDto.cs │ │ │ ├── Entities │ │ │ │ ├── EntityRole.cs │ │ │ │ ├── EntityUser.cs │ │ │ │ ├── Module.cs │ │ │ │ ├── ModuleFunction.cs │ │ │ │ ├── ModuleRole.cs │ │ │ │ └── ModuleUser.cs │ │ │ ├── FunctionAuthCache.cs │ │ │ ├── FunctionAuthManager.cs │ │ │ ├── FunctionAuthorizationPack.cs │ │ │ ├── ModuleHandler.cs │ │ │ └── ModuleSeedDataInitializer.cs │ │ ├── Common │ │ │ ├── CommonService.cs │ │ │ ├── Dtos │ │ │ │ ├── ListNode.cs │ │ │ │ └── TreeNode.cs │ │ │ └── ICommonContract.cs │ │ ├── Identity │ │ │ ├── AuthenticationPack.cs │ │ │ ├── Dtos │ │ │ │ ├── AutoMapperConfiguration.cs │ │ │ │ ├── ChangePasswordDto.cs │ │ │ │ ├── ConfirmEmailDto.cs │ │ │ │ ├── LoginDto.cs │ │ │ │ ├── ProfileEditDto.cs │ │ │ │ ├── RegisterDto.cs │ │ │ │ ├── ResetPasswordDto.cs │ │ │ │ ├── RoleInputDto.cs │ │ │ │ ├── RoleNode.cs │ │ │ │ ├── RoleOutputDto.cs │ │ │ │ ├── RoleOutputDto2.cs │ │ │ │ ├── SendMailDto.cs │ │ │ │ ├── UserInputDto.cs │ │ │ │ ├── UserLoginOutputDto.cs │ │ │ │ ├── UserOutputDto.cs │ │ │ │ ├── UserOutputDto2.cs │ │ │ │ ├── UserRoleInputDto.cs │ │ │ │ ├── UserRoleNode.cs │ │ │ │ └── UserRoleOutputDto.cs │ │ │ ├── Entities │ │ │ │ ├── LoginLog.cs │ │ │ │ ├── Organization.cs │ │ │ │ ├── Role.cs │ │ │ │ ├── RoleClaim.cs │ │ │ │ ├── User.cs │ │ │ │ ├── UserClaim.cs │ │ │ │ ├── UserDetail.cs │ │ │ │ ├── UserLogin.cs │ │ │ │ ├── UserRole.cs │ │ │ │ └── UserToken.cs │ │ │ ├── Events │ │ │ │ ├── LoginEventData.cs │ │ │ │ ├── Login_LoginLogEventHandler.cs │ │ │ │ ├── LogoutEventData.cs │ │ │ │ ├── Logout_LoginLogEventHandler.cs │ │ │ │ ├── Logout_RemoveRefreshTokenEventHandler.cs │ │ │ │ └── RegisterEventData.cs │ │ │ ├── IIdentityContract.cs │ │ │ ├── IdentityPack.cs │ │ │ ├── IdentityService.UserLogin.cs │ │ │ ├── IdentityService.UserRole.cs │ │ │ ├── IdentityService.cs │ │ │ ├── RoleSeedDataInitializer.cs │ │ │ ├── RoleStore.cs │ │ │ └── UserStore.cs │ │ ├── Infos │ │ │ ├── Dtos │ │ │ │ ├── MessageInputDto.cs │ │ │ │ ├── MessageInputDto.generated.cs │ │ │ │ ├── MessageOutputDto.generated.cs │ │ │ │ ├── MessageReceiveInputDto.generated.cs │ │ │ │ ├── MessageReceiveOutputDto.generated.cs │ │ │ │ ├── MessageReplyInputDto.generated.cs │ │ │ │ └── MessageReplyOutputDto.generated.cs │ │ │ ├── Entities │ │ │ │ ├── Message.cs │ │ │ │ ├── Message.generated.cs │ │ │ │ ├── MessageReceive.cs │ │ │ │ ├── MessageReceive.generated.cs │ │ │ │ ├── MessageReply.cs │ │ │ │ ├── MessageReply.generated.cs │ │ │ │ └── MessageType.cs │ │ │ ├── Events │ │ │ │ ├── MessageCreatedEventData.cs │ │ │ │ └── MessageCreatedEventHandler.cs │ │ │ ├── IInfosContract.generated.cs │ │ │ ├── InfosPack.cs │ │ │ ├── InfosService.Message.cs │ │ │ ├── InfosService.cs │ │ │ ├── InfosServiceBase.Message.generated.cs │ │ │ ├── InfosServiceBase.MessageReceive.generated.cs │ │ │ ├── InfosServiceBase.MessageReply.generated.cs │ │ │ └── InfosServiceBase.generated.cs │ │ ├── Liuliu.Demo.Core.csproj │ │ └── Systems │ │ │ ├── AuditDatabaseStore.cs │ │ │ ├── AuditPack.cs │ │ │ ├── AuditService.cs │ │ │ ├── Dtos │ │ │ ├── AuditEntityOutputDto.cs │ │ │ ├── AuditOperationOutputDto.cs │ │ │ ├── AuditPropertyOutputDto.cs │ │ │ ├── GenerateCodeInputDto.cs │ │ │ ├── PackOutputDto.cs │ │ │ └── SystemSetting.cs │ │ │ ├── Entities │ │ │ ├── AuditEntity.cs │ │ │ ├── AuditOperation.cs │ │ │ └── AuditProperty.cs │ │ │ ├── IAuditContract.cs │ │ │ ├── ISystemsContract.cs │ │ │ ├── KeyValueSeedDataInitializer.cs │ │ │ └── SystemsService.cs │ ├── Liuliu.Demo.EntityConfiguration │ │ ├── Authorization │ │ │ ├── EntityRoleConfiguration.cs │ │ │ ├── EntityUserConfiguration.cs │ │ │ ├── ModuleConfiguration.cs │ │ │ ├── ModuleFunctionConfiguration.cs │ │ │ ├── ModuleRoleConfiguration.cs │ │ │ └── ModuleUserConfiguration.cs │ │ ├── Identity │ │ │ ├── LoginLogConfiguration.cs │ │ │ ├── OrganizationConfiguration.cs │ │ │ ├── RoleClaimConfiguration.cs │ │ │ ├── RoleConfiguration.cs │ │ │ ├── UserClaimConfiguration.cs │ │ │ ├── UserConfiguration.cs │ │ │ ├── UserDetailConfiguration.cs │ │ │ ├── UserLoginConfiguration.cs │ │ │ ├── UserRoleConfiguration.cs │ │ │ └── UserTokenConfiguration.cs │ │ ├── Infos │ │ │ ├── MessageConfiguration.generated.cs │ │ │ ├── MessageReceiveConfiguration.generated.cs │ │ │ └── MessageReplyConfiguration.generated.cs │ │ ├── Liuliu.Demo.EntityConfiguration.csproj │ │ └── Systems │ │ │ ├── AuditEntityConfiguration.cs │ │ │ ├── AuditOperationConfiguration.cs │ │ │ ├── AuditPropertyConfiguration.cs │ │ │ └── KeyValueConfiguration.cs │ ├── Liuliu.Demo.Web │ │ ├── Areas │ │ │ └── Admin │ │ │ │ └── Controllers │ │ │ │ ├── AdminApiController.cs │ │ │ │ ├── Auth │ │ │ │ ├── EntityInfoController.cs │ │ │ │ ├── FunctionController.cs │ │ │ │ ├── ModuleController.cs │ │ │ │ ├── RoleEntityController.cs │ │ │ │ ├── RoleFunctionController.cs │ │ │ │ └── UserFunctionController.cs │ │ │ │ ├── DashboardController.cs │ │ │ │ ├── HomeController.cs │ │ │ │ ├── Identity │ │ │ │ ├── RoleController.cs │ │ │ │ ├── UserController.cs │ │ │ │ └── UserRoleController.cs │ │ │ │ ├── Infos │ │ │ │ ├── MessageController.cs │ │ │ │ ├── MessageControllerBase.generated.cs │ │ │ │ ├── MessageReceiveController.cs │ │ │ │ ├── MessageReceiveControllerBase.generated.cs │ │ │ │ ├── MessageReplyController.cs │ │ │ │ └── MessageReplyControllerBase.generated.cs │ │ │ │ └── Systems │ │ │ │ ├── AuditEntityController.cs │ │ │ │ ├── AuditOperationController.cs │ │ │ │ ├── PackController.cs │ │ │ │ └── SettingsController.cs │ │ ├── Controllers │ │ │ ├── AuthController.cs │ │ │ ├── CommonController.cs │ │ │ ├── IdentityController.cs │ │ │ ├── SiteApiControllerBase.cs │ │ │ ├── Test2Controller.cs │ │ │ └── TestController.cs │ │ ├── Dockerfile │ │ ├── Hangfire │ │ │ └── HangfireJobRunner.cs │ │ ├── Liuliu.Demo.Web.csproj │ │ ├── Migrations │ │ │ ├── 20250303081408_init.Designer.cs │ │ │ ├── 20250303081408_init.cs │ │ │ └── DefaultDbContextModelSnapshot.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Startups │ │ │ ├── DesignTimeDefaultDbContextFactory.cs │ │ │ ├── MySqlDefaultDbContextMigrationPack.cs │ │ │ ├── NpgsqlDefaultDbContextMigrationPack.cs │ │ │ ├── OracleDefaultDbContextMigrationPack.cs │ │ │ ├── SqlServerDefaultDbContextMigrationPack.cs │ │ │ └── SqliteDefaultDbContextMigrationPack.cs │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── log4net.config │ └── Liuliu.Demo.WebApi │ │ ├── .config │ │ └── dotnet-tools.json │ │ ├── Areas │ │ └── Admin │ │ │ └── Controllers │ │ │ ├── DashboardController.cs │ │ │ └── HomeController.cs │ │ ├── Controllers │ │ └── HomeController.cs │ │ ├── Dockerfile │ │ ├── Hangfire │ │ └── HangfireJobRunner.cs │ │ ├── Liuliu.Demo.WebApi.csproj │ │ ├── Migrations │ │ ├── 20221110065613_Init.Designer.cs │ │ ├── 20221110065613_Init.cs │ │ ├── 20231006102753_Comment.Designer.cs │ │ ├── 20231006102753_Comment.cs │ │ └── DefaultDbContextModelSnapshot.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Startups │ │ ├── DesignTimeDefaultDbContextFactory.cs │ │ ├── MySqlDefaultDbContextMigrationPack.cs │ │ ├── NpgsqlDefaultDbContextMigrationPack.cs │ │ ├── OracleDefaultDbContextMigrationPack.cs │ │ ├── SqlServerDefaultDbContextMigrationPack.cs │ │ └── SqliteDefaultDbContextMigrationPack.cs │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ └── log4net.config └── wpf │ ├── OSharp.CodeGeneration │ ├── Generates │ │ ├── CodeFile.cs │ │ ├── GenCodeConfig.cs │ │ ├── GeneratePack.cs │ │ ├── ICodeGenerator.cs │ │ ├── MetadataType.cs │ │ └── RazorCodeGenerator.cs │ ├── OSharp.CodeGeneration.csproj │ ├── Services │ │ ├── DataPack.cs │ │ ├── DataService.CodeEntity.cs │ │ ├── DataService.CodeForeign.cs │ │ ├── DataService.CodeModule.cs │ │ ├── DataService.CodeProject.cs │ │ ├── DataService.CodeProjectTemplate.cs │ │ ├── DataService.CodeProperty.cs │ │ ├── DataService.CodeTemplate.cs │ │ ├── DataService.cs │ │ ├── Dtos │ │ │ ├── CodeEntityInputDto.cs │ │ │ ├── CodeForeignInputDto.cs │ │ │ ├── CodeModuleInputDto.cs │ │ │ ├── CodeProjectInputDto.cs │ │ │ ├── CodeProjectTemplateInputDto.cs │ │ │ ├── CodePropertyInputDto.cs │ │ │ └── CodeTemplateInputDto.cs │ │ ├── Entities │ │ │ ├── CodeEntity.cs │ │ │ ├── CodeEntityConfiguration.cs │ │ │ ├── CodeForeign.cs │ │ │ ├── CodeForeignConfiguration.cs │ │ │ ├── CodeModule.cs │ │ │ ├── CodeModuleConfiguration.cs │ │ │ ├── CodeProject.cs │ │ │ ├── CodeProjectConfiguration.cs │ │ │ ├── CodeProjectTemplate.cs │ │ │ ├── CodeProjectTemplateConfiguration.cs │ │ │ ├── CodeProperty.cs │ │ │ ├── CodePropertyConfiguration.cs │ │ │ ├── CodeTemplate.cs │ │ │ ├── CodeTemplateConfiguration.cs │ │ │ └── ForeignRelation.cs │ │ ├── IDataContract.cs │ │ └── Seeds │ │ │ ├── CodeEntitySeedDataInitializer.cs │ │ │ ├── CodeModuleSeedDataInitializer.cs │ │ │ ├── CodeProjectSeedDataInitializer.cs │ │ │ ├── CodePropertySeedDataInitializer.cs │ │ │ └── CodeTemplateSeedDataInitializer.cs │ ├── Templates │ │ ├── cs_AdminController.cshtml │ │ ├── cs_AdminControllerBase.cshtml │ │ ├── cs_Entity.cshtml │ │ ├── cs_EntityConfiguration.cshtml │ │ ├── cs_InputDto.cshtml │ │ ├── cs_OutputDto.cshtml │ │ ├── cs_ServiceContract.cshtml │ │ ├── cs_ServiceEntityImplBase.cshtml │ │ ├── cs_ServiceMainImpl.cshtml │ │ ├── cs_ServiceMainImplBase.cshtml │ │ ├── cs_ServicePack.cshtml │ │ ├── ng_AlainComponent.cshtml │ │ ├── ng_AlainComponentHtml.cshtml │ │ ├── ng_AlainModule.cshtml │ │ ├── ng_AlainOther.cshtml │ │ ├── ng_AlainRouting.cshtml │ │ ├── vue_VbenLocalesLangEn.cshtml │ │ ├── vue_VbenLocalesLangZhCN.cshtml │ │ ├── vue_VbenRouterRoutes.cshtml │ │ └── vue_VbenViewsVue.cshtml │ └── Utils │ │ └── TypeHelper.cs │ └── OSharp.CodeGenerator │ ├── App.xaml │ ├── App.xaml.cs │ ├── AssemblyInfo.cs │ ├── Bootstrapper.cs │ ├── Data │ ├── AutoMapperConfiguration.cs │ ├── DesignTimeDefaultDbContextFactory.cs │ ├── Extensions.cs │ ├── Helper.cs │ └── SqliteDefaultDbContextMigrationPack.cs │ ├── FodyWeavers.xml │ ├── FodyWeavers.xsd │ ├── Migrations │ ├── 20210410154733_Init.Designer.cs │ ├── 20210410154733_Init.cs │ ├── 20210412033738_RootPath.Designer.cs │ ├── 20210412033738_RootPath.cs │ ├── 20210412164047_OnDelete1.Designer.cs │ ├── 20210412164047_OnDelete1.cs │ ├── 20210425014631_Icon.Designer.cs │ ├── 20210425014631_Icon.cs │ ├── 20220113165940_IsEnum.Designer.cs │ ├── 20220113165940_IsEnum.cs │ ├── 20220121031306_Prop_Listable.Designer.cs │ ├── 20220121031306_Prop_Listable.cs │ ├── 20220122045133_IsHide.Designer.cs │ ├── 20220122045133_IsHide.cs │ └── DefaultDbContextModelSnapshot.cs │ ├── OSharp.CodeGenerator.csproj │ ├── Resources │ ├── SomeStyles.xaml │ ├── osharp128-2.ico │ ├── osharp128-2.png │ ├── osharp128.ico │ ├── osharp128.png │ └── osharp128.svg │ ├── Startup.cs │ ├── Templates │ └── CustomTemplate001.cshtml │ ├── Views │ ├── Entities │ │ ├── EntityListView.xaml │ │ ├── EntityListView.xaml.cs │ │ ├── EntityListViewModel.cs │ │ ├── EntityViewModel.cs │ │ ├── ForeignListView.xaml │ │ ├── ForeignListView.xaml.cs │ │ ├── ForeignListViewModel.cs │ │ └── ForeignViewModel.cs │ ├── Helps │ │ ├── AboutView.xaml │ │ ├── AboutView.xaml.cs │ │ └── AboutViewModel.cs │ ├── LoadFromEntities │ │ ├── LoadFromEntitiesView.xaml │ │ ├── LoadFromEntitiesView.xaml.cs │ │ └── LoadFromEntitiesViewModel.cs │ ├── MainMenuView.xaml │ ├── MainMenuView.xaml.cs │ ├── MainMenuViewModel.cs │ ├── MainView.xaml │ ├── MainView.xaml.cs │ ├── MainViewModel.cs │ ├── MenuView.xaml │ ├── MenuView.xaml.cs │ ├── MenuViewModel.cs │ ├── Modules │ │ ├── ModuleListView.xaml │ │ ├── ModuleListView.xaml.cs │ │ ├── ModuleListViewModel.cs │ │ └── ModuleViewModel.cs │ ├── Projects │ │ ├── ProjectEditView.xaml │ │ ├── ProjectEditView.xaml.cs │ │ ├── ProjectListView.xaml │ │ ├── ProjectListView.xaml.cs │ │ ├── ProjectListViewModel.cs │ │ ├── ProjectTemplateListView.xaml │ │ ├── ProjectTemplateListView.xaml.cs │ │ ├── ProjectTemplateListViewModel.cs │ │ ├── ProjectTemplateViewModel.cs │ │ └── ProjectViewModel.cs │ ├── Properties │ │ ├── PropertyListView.xaml │ │ ├── PropertyListView.xaml.cs │ │ ├── PropertyListViewModel.cs │ │ └── PropertyViewModel.cs │ ├── StatusBarViewModel.cs │ ├── StatusbarView.xaml │ ├── StatusbarView.xaml.cs │ ├── Templates │ │ ├── TemplateListView.xaml │ │ ├── TemplateListView.xaml.cs │ │ ├── TemplateListViewModel.cs │ │ └── TemplateViewModel.cs │ ├── ViewModelLocator.cs │ └── ViewModelPack.cs │ ├── appsettings.json │ ├── build │ └── osharp-code-generator.db.bak │ └── log4net.config ├── src ├── OSharp.AspNetCore.Diagnostics │ ├── HealthChecksPack.cs │ ├── HealthChecksPackBase.cs │ └── OSharp.AspNetCore.Diagnostics.csproj ├── OSharp.AspNetCore │ ├── ApplicationBuilderExtensions.cs │ ├── AspNetCorePack.cs │ ├── AspOsharpPack.cs │ ├── Cors │ │ ├── DefaultCorsInitializer.cs │ │ └── ICorsInitializer.cs │ ├── Http │ │ ├── HostHttpCrypto.cs │ │ ├── HostHttpCryptoMiddleware.cs │ │ ├── HttpExtensions.cs │ │ └── IHostHttpCrypto.cs │ ├── HttpContextCancellationTokenProvider.cs │ ├── HttpContextServiceScopeFactory.cs │ ├── HttpRequestExtensions.cs │ ├── IMiddleware.cs │ ├── IVerifyCodeService.cs │ ├── JsonExceptionHandlerMiddleware.cs │ ├── JsonNoFoundHandlerMiddleware.cs │ ├── Mvc │ │ ├── ApiControllerBase.cs │ │ ├── AreaApiControllerBase.cs │ │ ├── AreaBaseController.cs │ │ ├── AreaInfoAttribute.cs │ │ ├── BaseController.cs │ │ ├── Conventions │ │ │ └── DashedRoutingConvention.cs │ │ ├── Filters │ │ │ ├── AjaxOnlyAttribute.cs │ │ │ ├── AuditOperationAttribute.cs │ │ │ ├── UnitOfWorkAttribute.cs │ │ │ └── UnitOfWorkImpl.cs │ │ ├── ModelBinding │ │ │ ├── StringTrimModelBinder.cs │ │ │ └── StringTrimModelBinderProvider.cs │ │ ├── MvcExtensions.cs │ │ ├── MvcFunctionHandler.cs │ │ ├── MvcFunctionPack.cs │ │ ├── MvcModuleInfoPicker.cs │ │ ├── MvcPack.cs │ │ └── MvcPackBase.cs │ ├── OSharp.AspNetCore.csproj │ ├── RequestScopedServiceResolver.cs │ ├── Routing │ │ ├── EndpointsPack.cs │ │ └── EndpointsPackBase.cs │ ├── ServiceExtensions.cs │ ├── SignalR │ │ ├── ConnectionUser.cs │ │ ├── ConnectionUserCache.cs │ │ ├── EmailBaseUserIdProvider.cs │ │ ├── IConnectionUserCache.cs │ │ ├── OsharpHub.cs │ │ ├── SignalRPack.cs │ │ ├── SignalRPackBase.cs │ │ └── UserNameUserIdProvider.cs │ ├── UI │ │ ├── AjaxResult.cs │ │ └── AjaxResultExtensions.cs │ ├── VerifyCodeService.cs │ └── _GlobalUsing.cs ├── OSharp.Authorization.Datas │ ├── DataAuthCacheBase.cs │ ├── DataAuthorizationManagerBase.cs │ ├── DataAuthorizationPackBase.cs │ ├── Dtos │ │ ├── EntityInfoInputDto.cs │ │ ├── EntityInfoInputDtoBase.cs │ │ └── EntityRoleInputDtoBase.cs │ ├── Entities │ │ ├── EntityRoleBase.cs │ │ └── EntityUserBase.cs │ ├── Events │ │ └── DataAuthCacheRefreshEvent.cs │ ├── IEntityInfoStore.cs │ ├── IEntityRoleStore.cs │ ├── OSharp.Authorization.Datas.csproj │ └── _GlobalUsing.cs ├── OSharp.Authorization.Functions │ ├── ApiAuthorizeAttribute.cs │ ├── Dtos │ │ ├── FunctionInputDto.cs │ │ ├── FunctionInputDtoBase.cs │ │ └── ModuleInputDtoBase.cs │ ├── EndpointExtensions.cs │ ├── Entities │ │ ├── ModuleBase.cs │ │ ├── ModuleFunctionBase.cs │ │ ├── ModuleRoleBase.cs │ │ └── ModuleUserBase.cs │ ├── Events │ │ ├── FunctionAuthCacheRefreshEvent.cs │ │ └── FunctionCacheRefreshEvent.cs │ ├── FunctionAuthCacheBase.cs │ ├── FunctionAuthorizationHandler.cs │ ├── FunctionAuthorizationManagerBase.cs │ ├── FunctionAuthorizationPackBase.cs │ ├── FunctionRequirement.cs │ ├── IFunctionStore.cs │ ├── IModuleFunctionStore.cs │ ├── IModuleRoleStore.cs │ ├── IModuleStore.cs │ ├── IModuleUserStore.cs │ ├── ModuleHandlerBase.cs │ ├── OSharp.Authorization.Functions.csproj │ ├── ServiceCollectionExtensions.cs │ ├── SiteAuthorizeAttribute.cs │ └── _GlobalUsing.cs ├── OSharp.AutoMapper │ ├── AutoMapperMapper.cs │ ├── AutoMapperPack.cs │ ├── AutoMapperTupleBase.cs │ ├── MapFromAndMapToProfile.cs │ ├── OSharp.AutoMapper.csproj │ └── _GlobalUsing.cs ├── OSharp.CodeGeneration │ ├── CodeGenerationPack.cs │ ├── Entities │ │ ├── CodeEntity.cs │ │ ├── CodeModule.cs │ │ ├── CodeProject.cs │ │ └── CodeProperty.cs │ ├── GenerateContext.cs │ ├── ICodeGenerator.cs │ ├── IFileWriter.cs │ ├── OSharp.CodeGeneration.csproj │ ├── RazorCodeGenerator.cs │ ├── Schema │ │ ├── CodeFile.cs │ │ ├── CodeType.cs │ │ ├── EntityMetadata.cs │ │ ├── EnumMetadata.cs │ │ ├── ModuleMetadata.cs │ │ ├── ProjectMetadata.cs │ │ ├── PropertyMetadata.cs │ │ └── TypeHelper.cs │ └── Templates │ │ ├── AdminController.cshtml │ │ ├── Entity.cshtml │ │ ├── EntityConfiguration.cshtml │ │ ├── InputDto.cshtml │ │ ├── OutputDto.cshtml │ │ ├── ServiceContract.cshtml │ │ ├── ServiceEntityImpl.cshtml │ │ └── ServiceMainImpl.cshtml ├── OSharp.EntityFrameworkCore.MySql │ ├── MySqlDapperSqlExecutor.cs │ ├── MySqlDbContextOptionsBuilderDriveHandler.cs │ ├── MySqlEntityFrameworkCorePack.cs │ ├── MySqlSequentialGuidGenerator.cs │ ├── OSharp.EntityFrameworkCore.MySql.csproj │ └── _GlobalUsing.cs ├── OSharp.EntityFrameworkCore.Oracle │ ├── OSharp.EntityFrameworkCore.Oracle.csproj │ ├── OracleDapperSqlExecutor.cs │ ├── OracleDbContextOptionsBuilderDriveHandler.cs │ ├── OracleEntityFrameworkCorePack.cs │ ├── OracleSequentialGuidGenerator.cs │ └── _GlobalUsing.cs ├── OSharp.EntityFrameworkCore.PostgreSql │ ├── NpgsqlDapperSqlExecutor.cs │ ├── NpgsqlDbContextOptionsBuilderDriveHandler.cs │ ├── NpgsqlEntityFrameworkCorePack.cs │ ├── NpgsqlSequentialGuidGenerator.cs │ ├── OSharp.EntityFrameworkCore.PostgreSql.csproj │ └── _GlobalUsing.cs ├── OSharp.EntityFrameworkCore.SqlServer │ ├── OSharp.EntityFrameworkCore.SqlServer.csproj │ ├── SqlServerDapperSqlExecutor.cs │ ├── SqlServerDbContextOptionsBuilderDriveHandler.cs │ ├── SqlServerEntityFrameworkCorePack.cs │ ├── SqlServerSequentialGuidGenerator.cs │ └── _GlobalUsing.cs ├── OSharp.EntityFrameworkCore.Sqlite │ ├── OSharp.EntityFrameworkCore.Sqlite.csproj │ ├── SqliteDapperSqlExecutor.cs │ ├── SqliteDbContextOptionsBuilderDriveHandler.cs │ ├── SqliteEntityFrameworkCorePack.cs │ ├── SqliteSequentialGuidGenerator.cs │ └── _GlobalUsing.cs ├── OSharp.EntityFrameworkCore │ ├── AuditEntityProvider.cs │ ├── ConnectionStringProvider.cs │ ├── DbContextBase.cs │ ├── DbContextExtensions.cs │ ├── Defaults │ │ └── DefaultDbContext.cs │ ├── DesignTimeDbContextFactoryBase.cs │ ├── EntityDateTimeUtcConversion.cs │ ├── EntityFrameworkCorePackBase.cs │ ├── EntityManager.cs │ ├── EntityTypeConfigurationBase.cs │ ├── IAuditEntityProvider.cs │ ├── IDbContextOptionsBuilderDriveHandler.cs │ ├── IEntityBatchConfiguration.cs │ ├── IEntityDateTimeUtcConversion.cs │ ├── IEntityManager.cs │ ├── IEntityRegister.cs │ ├── Internal │ │ ├── DbContextModelCache.cs │ │ └── MasterSlaveSplitPolicy.cs │ ├── MigrationPackBase.cs │ ├── OSharp.EntityFrameworkCore.csproj │ ├── PropertyCommentConfiguration.cs │ ├── PropertyUtcDateTimeConfiguration.cs │ ├── Repository.cs │ ├── RepositoryExtensions.cs │ ├── ServiceExtensions.cs │ ├── SqlExecutorBase.cs │ ├── TableNamePrefixConfiguration.cs │ ├── UnitOfWork.cs │ └── _GlobalUsing.cs ├── OSharp.Exceptionless │ ├── ExceptionlessLogger.cs │ ├── ExceptionlessLoggerProvider.cs │ ├── ExceptionlessPack.cs │ ├── ExceptionlessPackCore.cs │ ├── OSharp.Exceptionless.csproj │ ├── README.md │ └── _GlobalUsing.cs ├── OSharp.Hangfire │ ├── HangfirePack.cs │ ├── HangfirePackBase.cs │ ├── IHangfireJobRunner.cs │ ├── OSharp.Hangfire.csproj │ ├── RoleDashboardAuthorizationFilter.cs │ └── _GlobalUsing.cs ├── OSharp.Hosting.Apis │ ├── Areas │ │ └── Admin │ │ │ └── Controllers │ │ │ ├── AdminApiControllerBase.cs │ │ │ ├── Auth │ │ │ ├── EntityInfoController.cs │ │ │ ├── FunctionController.cs │ │ │ ├── ModuleController.cs │ │ │ ├── RoleEntityController.cs │ │ │ ├── RoleFunctionController.cs │ │ │ └── UserFunctionController.cs │ │ │ ├── Identity │ │ │ ├── LoginLogController.cs │ │ │ ├── RoleController.cs │ │ │ ├── UserController.cs │ │ │ └── UserRoleController.cs │ │ │ ├── Infos │ │ │ ├── MessageController.cs │ │ │ ├── MessageControllerBase.generated.cs │ │ │ ├── MessageReceiveController.cs │ │ │ ├── MessageReceiveControllerBase.generated.cs │ │ │ ├── MessageReplyController.cs │ │ │ └── MessageReplyControllerBase.generated.cs │ │ │ └── Systems │ │ │ ├── AuditEntityController.cs │ │ │ ├── AuditOperationController.cs │ │ │ ├── MenuController.cs │ │ │ ├── PackController.cs │ │ │ └── SettingsController.cs │ ├── Controllers │ │ ├── AuthController.cs │ │ ├── CommonController.cs │ │ ├── IdentityController.cs │ │ ├── SiteApiControllerBase.cs │ │ └── TestController.cs │ ├── OSharp.Hosting.Apis.csproj │ └── _GlobalUsing.cs ├── OSharp.Hosting.Core │ ├── Authorization │ │ ├── DataAuthCache.cs │ │ ├── DataAuthManager.cs │ │ ├── DataAuthorizationPack.cs │ │ ├── Dtos │ │ │ ├── AutoMapperConfiguration.cs │ │ │ ├── EntityInfoNode.cs │ │ │ ├── EntityInfoOutputDto.cs │ │ │ ├── EntityRoleInputDto.cs │ │ │ ├── EntityRoleOutputDto.cs │ │ │ ├── FunctionOutputDto.cs │ │ │ ├── FunctionOutputDto2.cs │ │ │ ├── ModuleInputDto.cs │ │ │ ├── ModuleOutputDto.cs │ │ │ ├── ModuleSetFunctionDto.cs │ │ │ ├── RoleSetModuleDto.cs │ │ │ ├── UserSetModuleDto.cs │ │ │ └── UserSetRoleDto.cs │ │ ├── Entities │ │ │ ├── EntityRole.cs │ │ │ ├── EntityUser.cs │ │ │ ├── Module.cs │ │ │ ├── ModuleFunction.cs │ │ │ ├── ModuleRole.cs │ │ │ └── ModuleUser.cs │ │ ├── FunctionAuthCache.cs │ │ ├── FunctionAuthManager.cs │ │ ├── FunctionAuthorizationPack.cs │ │ ├── ModuleHandler.cs │ │ └── ModuleSeedDataInitializer.cs │ ├── Common │ │ ├── CommonService.cs │ │ ├── Dtos │ │ │ ├── ListNode.cs │ │ │ └── TreeNode.cs │ │ └── ICommonContract.cs │ ├── Identity │ │ ├── AuthenticationPack.cs │ │ ├── Dtos │ │ │ ├── AutoMapperConfiguration.cs │ │ │ ├── ChangePasswordDto.cs │ │ │ ├── ConfirmEmailDto.cs │ │ │ ├── LoginDto.cs │ │ │ ├── LoginLogOutputDto.cs │ │ │ ├── ProfileEditDto.cs │ │ │ ├── RegisterDto.cs │ │ │ ├── ResetPasswordDto.cs │ │ │ ├── RoleInputDto.cs │ │ │ ├── RoleNode.cs │ │ │ ├── RoleOutputDto.cs │ │ │ ├── RoleOutputDto2.cs │ │ │ ├── SendMailDto.cs │ │ │ ├── UserInputDto.cs │ │ │ ├── UserLoginOutputDto.cs │ │ │ ├── UserOutputDto.cs │ │ │ ├── UserOutputDto2.cs │ │ │ ├── UserRoleInputDto.cs │ │ │ ├── UserRoleNode.cs │ │ │ └── UserRoleOutputDto.cs │ │ ├── Entities │ │ │ ├── LoginLog.cs │ │ │ ├── Organization.cs │ │ │ ├── Role.cs │ │ │ ├── RoleClaim.cs │ │ │ ├── User.cs │ │ │ ├── UserClaim.cs │ │ │ ├── UserDetail.cs │ │ │ ├── UserLogin.cs │ │ │ ├── UserRole.cs │ │ │ └── UserToken.cs │ │ ├── Events │ │ │ ├── LoginEventData.cs │ │ │ ├── Login_LoginLogEventHandler.cs │ │ │ ├── LogoutEventData.cs │ │ │ ├── Logout_LoginLogEventHandler.cs │ │ │ ├── Logout_RemoveRefreshTokenEventHandler.cs │ │ │ └── RegisterEventData.cs │ │ ├── IIdentityContract.cs │ │ ├── IdentityPack.cs │ │ ├── IdentityService.LoginLog.cs │ │ ├── IdentityService.UserLogin.cs │ │ ├── IdentityService.UserRole.cs │ │ ├── IdentityService.cs │ │ ├── RoleSeedDataInitializer.cs │ │ ├── RoleStore.cs │ │ └── UserStore.cs │ ├── Infos │ │ ├── Dtos │ │ │ ├── MessageInputDto.cs │ │ │ ├── MessageInputDto.generated.cs │ │ │ ├── MessageOutputDto.generated.cs │ │ │ ├── MessageReceiveInputDto.generated.cs │ │ │ ├── MessageReceiveOutputDto.generated.cs │ │ │ ├── MessageReplyInputDto.generated.cs │ │ │ └── MessageReplyOutputDto.generated.cs │ │ ├── Entities │ │ │ ├── Message.cs │ │ │ ├── Message.generated.cs │ │ │ ├── MessageReceive.cs │ │ │ ├── MessageReceive.generated.cs │ │ │ ├── MessageReply.cs │ │ │ ├── MessageReply.generated.cs │ │ │ └── MessageType.cs │ │ ├── Events │ │ │ ├── MessageCreatedEventData.cs │ │ │ └── MessageCreatedEventHandler.cs │ │ ├── IInfosContract.generated.cs │ │ ├── InfosPack.cs │ │ ├── InfosService.Message.cs │ │ ├── InfosService.cs │ │ ├── InfosServiceBase.Message.generated.cs │ │ ├── InfosServiceBase.MessageReceive.generated.cs │ │ ├── InfosServiceBase.MessageReply.generated.cs │ │ └── InfosServiceBase.generated.cs │ ├── OSharp.Hosting.Core.csproj │ ├── Systems │ │ ├── AuditDatabaseStore.cs │ │ ├── AuditPack.cs │ │ ├── AuditService.cs │ │ ├── Dtos │ │ │ ├── AuditEntityOutputDto.cs │ │ │ ├── AuditOperationOutputDto.cs │ │ │ ├── AuditPropertyOutputDto.cs │ │ │ ├── AutoMapperConfiguration.cs │ │ │ ├── GenerateCodeInputDto.cs │ │ │ ├── MenuInputDto.cs │ │ │ ├── MenuOutputDto.cs │ │ │ ├── PackOutputDto.cs │ │ │ └── SystemSetting.cs │ │ ├── Entities │ │ │ ├── AuditEntity.cs │ │ │ ├── AuditOperation.cs │ │ │ ├── AuditProperty.cs │ │ │ └── Menu.cs │ │ ├── IAuditContract.cs │ │ ├── ISystemsContract.cs │ │ ├── KeyValueSeedDataInitializer.cs │ │ ├── SystemsPack.cs │ │ ├── SystemsService.Menu.cs │ │ └── SystemsService.cs │ ├── Utils │ │ └── MailKitSender.cs │ └── _GlobalUsing.cs ├── OSharp.Hosting.EntityConfiguration │ ├── Authorization │ │ ├── EntityRoleConfiguration.cs │ │ ├── EntityUserConfiguration.cs │ │ ├── ModuleConfiguration.cs │ │ ├── ModuleFunctionConfiguration.cs │ │ ├── ModuleRoleConfiguration.cs │ │ └── ModuleUserConfiguration.cs │ ├── Identity │ │ ├── LoginLogConfiguration.cs │ │ ├── OrganizationConfiguration.cs │ │ ├── RoleClaimConfiguration.cs │ │ ├── RoleConfiguration.cs │ │ ├── UserClaimConfiguration.cs │ │ ├── UserConfiguration.cs │ │ ├── UserDetailConfiguration.cs │ │ ├── UserLoginConfiguration.cs │ │ ├── UserRoleConfiguration.cs │ │ └── UserTokenConfiguration.cs │ ├── Infos │ │ ├── MessageConfiguration.generated.cs │ │ ├── MessageReceiveConfiguration.generated.cs │ │ └── MessageReplyConfiguration.generated.cs │ ├── OSharp.Hosting.EntityConfiguration.csproj │ ├── Systems │ │ ├── AuditEntityConfiguration.cs │ │ ├── AuditOperationConfiguration.cs │ │ ├── AuditPropertyConfiguration.cs │ │ ├── KeyValueConfiguration.cs │ │ └── MenuConfiguration.cs │ └── _GlobalUsing.cs ├── OSharp.Identity │ ├── Authentication │ │ ├── AuthenticationPackBase.cs │ │ ├── Cookies │ │ │ └── OsharpCookieAuthenticationEvents.cs │ │ ├── IUserClaimsProvider.cs │ │ ├── JwtBearer │ │ │ ├── JwtBearerService.cs │ │ │ └── OsharpJwtBearerEvents.cs │ │ ├── OAuth2 │ │ │ ├── ExternalLoginInfoExtensions.cs │ │ │ └── UserLoginInfoEx.cs │ │ └── UserClaimsProvider.cs │ ├── Identity │ │ ├── Dtos │ │ │ ├── RoleInputDtoBase.cs │ │ │ ├── UserInputDtoBase.cs │ │ │ └── UserRoleInputDtoBase.cs │ │ ├── Entities │ │ │ ├── RoleBase.cs │ │ │ ├── RoleClaimBase.cs │ │ │ ├── UserBase.cs │ │ │ ├── UserClaimBase.cs │ │ │ ├── UserLoginBase.cs │ │ │ ├── UserRoleBase.cs │ │ │ └── UserTokenBase.cs │ │ ├── Events │ │ │ └── OnlineUserCacheRemoveEvent.cs │ │ ├── IOsharpUserAuthenticationTokenStore.cs │ │ ├── IdentityErrorDescriberZhHans.cs │ │ ├── IdentityExtensions.cs │ │ ├── IdentityPackBase.cs │ │ ├── OnlineUserProvider.cs │ │ ├── README.md │ │ ├── RoleStoreBase.cs │ │ ├── UserManagerExtensions.cs │ │ ├── UserNickNameValidator.cs │ │ └── UserStoreBase.cs │ ├── OSharp.Identity.csproj │ └── _GlobalUsing.cs ├── OSharp.Log4Net │ ├── Log4NetLogger.cs │ ├── Log4NetLoggerProvider.cs │ ├── Log4NetPack.cs │ ├── OSharp.Log4Net.csproj │ ├── _GlobalUsing.cs │ └── log4net.config ├── OSharp.MiniProfiler │ ├── MiniProfilerPack.cs │ ├── MiniProfilerPackBase.cs │ ├── OSharp.MiniProfiler.csproj │ └── _GlobalUsing.cs ├── OSharp.NLog │ ├── NLogLogger.cs │ ├── NLogLoggerProvider.cs │ ├── NLogPack.cs │ ├── OSharp.NLog.csproj │ ├── _GlobalUsing.cs │ └── nlog.config ├── OSharp.Redis │ ├── OSharp.Redis.csproj │ ├── Readme.md │ ├── RedisClient.cs │ ├── RedisConnectionHelper.cs │ ├── RedisPack.cs │ ├── RedisPackBase.cs │ └── _GlobalUsing.cs ├── OSharp.Swagger │ ├── HiddenApiAttribute.cs │ ├── HiddenApiFilter.cs │ ├── OSharp.Swagger.csproj │ ├── Readme.md │ ├── SwaggerPack.cs │ ├── SwaggerPackBase.cs │ ├── _GlobalUsing.cs │ └── index.html ├── OSharp.Utils │ ├── Caching │ │ ├── DistributedCacheExtensions.cs │ │ ├── Evaluator.cs │ │ ├── ExpressionCacheKeyGenerator.cs │ │ ├── ICacheKeyGenerator.cs │ │ ├── LocalCollectionExpressionVisitor.cs │ │ └── StringCacheKeyGenerator.cs │ ├── Collections │ │ ├── ArrayExtensions.cs │ │ ├── CollectionExtensions.cs │ │ ├── ComparisonHelper.cs │ │ ├── EnumerableExtensions.cs │ │ ├── EqualityHelper.cs │ │ └── QueryableExtensions.cs │ ├── CommandLine │ │ └── CmdExecutor.cs │ ├── Data │ │ ├── AjaxResultType.cs │ │ ├── Check.cs │ │ ├── CombGuid.cs │ │ ├── Compression.cs │ │ ├── DataErrorInfoBase.cs │ │ ├── Disposable.cs │ │ ├── IOSharpResult.cs │ │ ├── OSharpResult.cs │ │ ├── OperationResult.cs │ │ ├── OperationResultType.cs │ │ ├── OsharpConstants.cs │ │ ├── PinyinConverter.cs │ │ ├── RegexPatterns.cs │ │ ├── SequentialGuid.cs │ │ ├── SequentialGuidType.cs │ │ ├── SerializeHelper.cs │ │ ├── Singleton.cs │ │ ├── SingletonDictionary.cs │ │ ├── SingletonList.cs │ │ └── Snows │ │ │ ├── Contract │ │ │ ├── IIdGenerator.cs │ │ │ ├── ISnowWorker.cs │ │ │ ├── IdGeneratorOptions.cs │ │ │ └── OverCostActionArg.cs │ │ │ ├── Core │ │ │ ├── SnowWorkerM1.cs │ │ │ └── SnowWorkerM2.cs │ │ │ ├── DefaultIdGenerator.cs │ │ │ └── IdHelper.cs │ ├── DataAnnotations │ │ └── PasswordAttribute.cs │ ├── Dependency │ │ └── Lazier.cs │ ├── Develop │ │ ├── CodeRamer.cs │ │ ├── CodeTimer.cs │ │ └── T4 │ │ │ └── T4ModelInfo.cs │ ├── Drawing │ │ ├── BitmapExtensions.cs │ │ ├── ValidateCodeType.cs │ │ └── ValidateCoder.cs │ ├── Dynamic │ │ ├── Exposed.cs │ │ └── MetaObject.cs │ ├── Entity │ │ └── DatabaseType.cs │ ├── Exceptions │ │ ├── ExceptionExtensions.cs │ │ ├── ExceptionMessage.cs │ │ └── OSharpException.cs │ ├── Extensions │ │ ├── BooleanExtensions.cs │ │ ├── DictionaryExtensions.cs │ │ ├── EnumExtensions.cs │ │ ├── ObjectExtensions.cs │ │ ├── ParamterCheckExtensions.cs │ │ ├── RandomExtensions.cs │ │ ├── ServiceExtensions.cs │ │ ├── StreamExtensions.cs │ │ ├── StringBuilderExtensions.cs │ │ ├── StringExtensions.cs │ │ └── TryCatchExtensions.cs │ ├── Filter │ │ ├── CollectionPropertySorter.cs │ │ ├── PageCondition.cs │ │ ├── PageData.cs │ │ ├── PageResult.cs │ │ └── SortCondition.cs │ ├── Http │ │ ├── HttpExtensions.cs │ │ ├── JsonContent.cs │ │ └── TransmissionEncryptor.cs │ ├── IO │ │ ├── DirectoryHelper.cs │ │ └── FileHelper.cs │ ├── Json │ │ ├── JsonExtensions.cs │ │ └── JsonHelper.cs │ ├── Linq │ │ ├── ExpressionExtensions.cs │ │ └── LinqToXmlExtensions.cs │ ├── Localized │ │ └── LocalizedDescriptionAttribute.cs │ ├── Logging │ │ ├── LoggerExtensions.cs │ │ └── RollingFile │ │ │ ├── FileLoggerFactoryExtensions.cs │ │ │ ├── FileLoggerOptions.cs │ │ │ ├── Internal │ │ │ ├── BatchingLogger.cs │ │ │ ├── BatchingLoggerOptions.cs │ │ │ ├── BatchingLoggerProvider.cs │ │ │ └── LogMessageEntry.cs │ │ │ └── RollingFileLoggerProvider.cs │ ├── Maths │ │ ├── AnyRadixConvert.cs │ │ └── MathHelper.cs │ ├── Net │ │ ├── IpLocation.cs │ │ ├── IpLocator.cs │ │ ├── NetHelper.cs │ │ └── UserAgent.cs │ ├── OSharp.Utils.csproj │ ├── Properties │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Reflection │ │ ├── AssemblyExtensions.cs │ │ ├── ComLibraryLoader.cs │ │ ├── FastInvokeHandler.cs │ │ ├── IComClassFactory.cs │ │ ├── LockExtensions.cs │ │ ├── NativeMethods.cs │ │ ├── SyncLocker.cs │ │ └── TypeExtensions.cs │ ├── Security │ │ ├── AesHelper.cs │ │ ├── HashHelper.cs │ │ └── RsaHelper.cs │ ├── Threading │ │ ├── AsyncHelper.cs │ │ ├── Asyncs │ │ │ ├── AsyncAutoResetEvent.cs │ │ │ ├── AsyncBarrier.cs │ │ │ ├── AsyncCountdownEvent.cs │ │ │ ├── AsyncLock.cs │ │ │ ├── AsyncManualResetEvent.cs │ │ │ ├── AsyncReaderWriterLock.cs │ │ │ └── AsyncSemaphore.cs │ │ ├── ICancellationTokenProvider.cs │ │ ├── NoneCancellationTokenProvider.cs │ │ └── ThreadExtensions.cs │ ├── Timing │ │ ├── DateTimeExtensions.cs │ │ ├── DateTimeRange.cs │ │ └── TimeSpanExtensions.cs │ └── Web │ │ └── UserAgentHelper.cs ├── OSharp.Wpf │ ├── Converters │ │ ├── BitmapToImageSourceConverter.cs │ │ ├── BooleanToNoConverter.cs │ │ ├── BooleanToNoVisibilityConverter.cs │ │ ├── BooleanToVisibilityConverter.cs │ │ ├── DateTimeToStringConverter.cs │ │ ├── EnumBooleanConverter.cs │ │ ├── FontWeightConverter.cs │ │ ├── StringToBooleanConverter.cs │ │ ├── StringToVisibilityConverter.cs │ │ └── TimeSpanToStringConverter.cs │ ├── Data │ │ ├── Output.cs │ │ └── WpfConstants.cs │ ├── FluentValidation │ │ └── FluentModelValidator.cs │ ├── Hubs │ │ ├── HubClientBase.cs │ │ ├── HubConnectionExtensions.cs │ │ ├── IHubClient.cs │ │ └── Reflection │ │ │ ├── Extensions.cs │ │ │ ├── Invocation.cs │ │ │ └── MethodCallInfo.cs │ ├── OSharp.Wpf.csproj │ ├── Styles │ │ └── SomeStyles.xaml │ ├── Stylet │ │ ├── IoC.cs │ │ ├── ServiceExtensions.cs │ │ ├── ServiceProviderBootstrapper.cs │ │ └── SingletonAttribute.cs │ ├── Utilities │ │ ├── PublicUtils.cs │ │ └── User32.cs │ ├── Xaml │ │ ├── PasswordBoxHelper.cs │ │ └── PopupHelper.cs │ └── _GlobalUsing.cs └── OSharp │ ├── Audits │ ├── AuditEntityEntry.cs │ ├── AuditEntityEvent.cs │ ├── AuditIgnoreAttribute.cs │ ├── AuditOperationEntry.cs │ ├── AuditPackBase.cs │ ├── AuditPropertyEntry.cs │ ├── IAuditStore.cs │ └── OperateType.cs │ ├── Authorization │ ├── AuthorizationResult.cs │ ├── AuthorizationStatus.cs │ ├── DataAuthCacheItem.cs │ ├── DataAuthOperation.cs │ ├── DataAuthService.cs │ ├── EntityInfos │ │ ├── EntityInfo.cs │ │ ├── EntityInfoBase.cs │ │ ├── EntityInfoHandler.cs │ │ ├── EntityInfoHandlerBase.cs │ │ ├── EntityInfoPack.cs │ │ ├── EntityProperty.cs │ │ ├── IEntityInfo.cs │ │ └── IEntityInfoHandler.cs │ ├── FunctionAuthorization.cs │ ├── FunctionAuthorizationBase.cs │ ├── Functions │ │ ├── Function.cs │ │ ├── FunctionAccessType.cs │ │ ├── FunctionBase.cs │ │ ├── FunctionHandlerBase.cs │ │ ├── IFunction.cs │ │ ├── IFunctionHandler.cs │ │ └── NonFunctionAttribute.cs │ ├── IDataAuthCache.cs │ ├── IDataAuthService.cs │ ├── IFunctionAuthCache.cs │ ├── IFunctionAuthorization.cs │ ├── LoggedInAttribute.cs │ ├── Modules │ │ ├── DependOnFunctionAttribute.cs │ │ ├── IModuleHandler.cs │ │ ├── IModuleInfoPicker.cs │ │ ├── ModuleInfo.cs │ │ ├── ModuleInfoAttribute.cs │ │ └── ModuleInfoPickerBase.cs │ └── RoleLimitAttribute.cs │ ├── Caching │ ├── CacheService.cs │ ├── DistributedCacheExtensions.cs │ └── ICacheService.cs │ ├── CodeGenerator │ ├── EnumMetadata.cs │ ├── ITypeMetadataHandler.cs │ ├── IgnoreGenPropertyAttribute.cs │ ├── IgnoreGenTypeAttribute.cs │ ├── PropertyMetadata.cs │ ├── TypeMetadata.cs │ └── TypeMetadataHandler.cs │ ├── Core │ ├── Builders │ │ ├── IOSharpBuilder.cs │ │ ├── OSharpBuilder.cs │ │ └── OSharpBuilderExtensions.cs │ ├── Data │ │ └── IKeyValue.cs │ ├── Options │ │ ├── AppSettingsReader.cs │ │ ├── ConfigurationExtensions.cs │ │ ├── CookieOptions.cs │ │ ├── CorsOptions.cs │ │ ├── HttpEncryptOptions.cs │ │ ├── JwtOptions.cs │ │ ├── MailSenderOptions.cs │ │ ├── MvcOptions.cs │ │ ├── OAuth2Options.cs │ │ ├── OSharpDbContextOptions.cs │ │ ├── OSharpOptions.cs │ │ ├── OSharpOptionsSetup.cs │ │ ├── RedisOptions.cs │ │ ├── SlaveDatabaseOptions.cs │ │ └── SwaggerOptions.cs │ ├── Packs │ │ ├── DependsOnPacksAttribute.cs │ │ ├── OSharpCorePack.cs │ │ ├── OsharpPack.cs │ │ └── PackLevel.cs │ └── Systems │ │ ├── IKeyValueStore.cs │ │ ├── ISetting.cs │ │ ├── KeyValue.cs │ │ ├── KeyValueOutputDto.cs │ │ ├── KeyValueStore.cs │ │ ├── SettingInputDto.cs │ │ ├── SettingOutputDto.cs │ │ └── SystemSettingKeys.cs │ ├── Data │ └── Check2.cs │ ├── Dependency │ ├── DefaultServiceScopeFactory.cs │ ├── DependencyAttribute.cs │ ├── DependencyPack.cs │ ├── IHybridServiceScopeFactory.cs │ ├── IScopeDependency.cs │ ├── IScopedServiceResolver.cs │ ├── ISingletonDependency.cs │ ├── ITransientDependency.cs │ ├── IgnoreDependencyAttribute.cs │ ├── Lazier.cs │ ├── MultipleDependencyAttribute.cs │ ├── ScopedDictionary.cs │ ├── ScopedDictionaryExtensions.cs │ └── ServiceLocator.cs │ ├── Entity │ ├── CollectionExtensions.cs │ ├── DynamicProxy │ │ ├── ITransactionDecision.cs │ │ ├── OperationResultTransactionDecision.cs │ │ └── TransactionalAttribute.cs │ ├── EntityBase.cs │ ├── EntityHashExtensions.cs │ ├── EntityInterfaceExtensions.cs │ ├── ExpirableBase.cs │ ├── IConnectionStringProvider.cs │ ├── ICreatedTime.cs │ ├── ICreationAudited.cs │ ├── IDbContext.cs │ ├── IEntity.cs │ ├── IEntityDto.cs │ ├── IEntityHash.cs │ ├── IExpirable.cs │ ├── ILockable.cs │ ├── IMasterSlaveSplitPolicy.cs │ ├── IRepository.cs │ ├── ISeedDataInitializer.cs │ ├── ISlaveDatabaseSelector.cs │ ├── ISoftDeletable.cs │ ├── ISqlExecutor.cs │ ├── IUnitOfWork.cs │ ├── IUpdateAudited.cs │ ├── InputDtoValidateExtensions.cs │ ├── KeyGenerate │ │ ├── AutoIncreaseKeyGenerator.cs │ │ ├── IKeyGenerator.cs │ │ ├── ISequentialGuidGenerator.cs │ │ └── SnowKeyGenerator.cs │ ├── RandomSlaveDatabaseSelector.cs │ ├── SeedDataInitializerBase.cs │ ├── SequenceSlaveDatabaseSelector.cs │ ├── TableNamePrefixAttribute.cs │ ├── UserFlagAttribute.cs │ └── WeightSlaveDatabaseSelector.cs │ ├── EventBuses │ ├── EventBusBase.cs │ ├── EventBusPack.cs │ ├── EventDataBase.cs │ ├── EventHandlerBase.cs │ ├── IEventBus.cs │ ├── IEventBusBuilder.cs │ ├── IEventData.cs │ ├── IEventHandler.cs │ ├── IEventHandlerFactory.cs │ ├── IEventPublisher.cs │ ├── IEventStore.cs │ ├── IEventSubscriber.cs │ └── Internal │ │ ├── ActionEventHandler.cs │ │ ├── EventBusBuilder.cs │ │ ├── EventHandlerDisposeWrapper.cs │ │ ├── InMemoryEventStore.cs │ │ ├── IocEventHandlerFactory.cs │ │ ├── PassThroughEventBus.cs │ │ ├── SingletonEventHandlerFactory.cs │ │ └── TransientEventHandlerFactory.cs │ ├── Extensions │ └── ServiceExtensions.cs │ ├── Filter │ ├── CheckExistsType.cs │ ├── FilterExtensions.cs │ ├── FilterGroup.cs │ ├── FilterHelper.cs │ ├── FilterOperate.cs │ ├── FilterRule.cs │ ├── FilterService.cs │ ├── IFilterService.cs │ ├── OperateCodeAttribute.cs │ └── PageRequest.cs │ ├── Finders │ ├── FinderBase.cs │ └── IFinder.cs │ ├── Http │ ├── ClientHttpCryptoHandler.cs │ ├── ClientHttpCryptor.cs │ ├── HttpHeaderNames.cs │ └── IClientHttpCrypto.cs │ ├── Identity │ ├── ClaimsIdentityExtensions.cs │ ├── IOnlineUserProvider.cs │ ├── JwtBearer │ │ ├── GrantType.cs │ │ ├── IJwtBearerService.cs │ │ ├── JsonWebToken.cs │ │ ├── RefreshToken.cs │ │ └── TokenDto.cs │ ├── OnlineUser.cs │ ├── RequestClientType.cs │ └── ServiceProviderExtensions.cs │ ├── Logging │ └── StartupLogger.cs │ ├── Mapping │ ├── IMapTuple.cs │ ├── IMapper.cs │ ├── MapFromAttribute.cs │ ├── MapToAttribute.cs │ └── MapperExtensions.cs │ ├── Net │ ├── DefaultEmailSender.cs │ └── IEmailSender.cs │ ├── OSharp.csproj │ ├── Properties │ ├── Resources.Designer.cs │ └── Resources.resx │ ├── Reflection │ ├── AssemblyManager.cs │ ├── IAssemblyFinder.cs │ ├── IMethodInfoFinder.cs │ └── PublicInstanceMethodInfoFinder.cs │ └── _GlobalUsing.cs └── tests ├── Liuliu.Demo.Core.Tests ├── CoreTest.cs ├── Identity │ └── InputDtoValidateExtensionsTests.cs └── Liuliu.Demo.Core.Tests.csproj ├── OSharp.AspNetCore.Tests ├── Http │ ├── HostHttpCryptoMiddlewareTests.cs │ └── HttpExtensionsTests.cs ├── JsonExceptionHandlerMiddlewareTests.cs ├── JsonNoFoundHandlerMiddlewareTests.cs ├── Mvc │ ├── Controllers.cs │ ├── MvcExtensionsTests.cs │ └── MvcFunctionHandlerTests.cs ├── OSharp.AspNetCore.Tests.csproj └── appsettings.json ├── OSharp.AutoMapper.Tests ├── AutoMapperTests.cs ├── OSharp.AutoMapper.Tests.csproj └── appsettings.json ├── OSharp.Tests ├── Audits │ ├── AuditEntityEntryTests.cs │ ├── AuditEntityEventDataTests.cs │ ├── AuditOperationEntryTests.cs │ └── AuditPackBaseTests.cs ├── Authorization │ ├── AuthorizationResultTests.cs │ ├── AuthorizationStatusTests.cs │ ├── DataAuthServiceTests.cs │ └── EntityInfos │ │ ├── EntityInfoBaseTests.cs │ │ └── EntityInfoHandlerTests.cs ├── Caching │ ├── ArrayExtensionsTests.cs │ ├── DistributedCacheExtensionsTests.cs │ ├── ExpressionCacheKeyGeneratorTests.cs │ └── StringCacheKeyGeneratorTests.cs ├── Collections │ ├── CollectionExtensionsTests.cs │ ├── ComparisonHelperTests.cs │ ├── EnumerableExtensionsTests.cs │ ├── EqualityHelperTests.cs │ └── QueryableExtensionsTests.cs ├── CommandLine │ ├── CmdExecutorTests.cs │ └── test.bat ├── Data │ ├── CheckTests.cs │ ├── CombGuidTests.cs │ ├── CompressionTests.cs │ ├── PinYinConverterTests.cs │ ├── SequentialGuidTests.cs │ └── SerializeHelperTests.cs ├── DataAnnotations │ └── PasswordAttributeTests.cs ├── Dependency │ ├── AppServiceAdderTests.cs │ ├── IgnoreDependencyAttributeTests.cs │ └── ServiceCollectionTests.cs ├── Develop │ ├── CodeRamerTests.cs │ ├── CodeTimerTests.cs │ ├── T4 │ │ └── T4ModelInfoTests.cs │ └── xUnitDemo.cs ├── Entity │ ├── EntityBaseTests.cs │ ├── EntityInterfaceExtensionsTests.cs │ ├── ExpirableBaseTests.cs │ ├── RandomSlaveDatabaseSelectorTests.cs │ ├── SequenceSlaveDatabaseSelectorTests.cs │ └── WeightSlaveDatabaseSelectorTests.cs ├── EventBuses │ └── EventBusTest.cs ├── Exceptions │ └── ExceptionExtensionsTests.cs ├── Extensions │ ├── BooleanExtensionsTests.cs │ ├── DictionaryExtensionsTests.cs │ ├── EnumExtensionsTests.cs │ ├── ExpressionExtensionsTests.cs │ ├── ObjectExtensionsTests.cs │ ├── ParameterCheckExtensionsTests.cs │ ├── RandomExtensionsTest.cs │ ├── StringBuilderExtensionsTest.cs │ └── StringExtensionsTests.cs ├── Filter │ ├── CollectionPropertySorterTests.cs │ ├── FilterGroupTests.cs │ └── FilterHelperTests.cs ├── Http │ ├── ClientHttpCryptoHandlerTests.cs │ ├── HttpExtensionsTests.cs │ └── TransmissionEncryptorTests.cs ├── Json │ └── JsonHelperTests.cs ├── Maths │ └── AnyRadixConvertTests.cs ├── Net │ └── NetHelperTests.cs ├── OSharp.Tests.csproj ├── Reflection │ └── TypeExtensionsTests.cs ├── Security │ ├── AesHelperTests.cs │ ├── HashHelperTests.cs │ └── RsaHelperTests.cs ├── Startups │ └── StartupTests.cs ├── TestClass.cs ├── Threading │ └── ThreadExtensionsTests.cs ├── Timing │ ├── DateTimeExtensionsTests.cs │ └── DateTimeRangeTests.cs └── appsettings.json └── OSharp.UnitTest.Infrastructure ├── AppUnitTestBase.cs ├── AspNetCoreUnitTestBase.cs ├── AssertExtensions.cs ├── EntityTestBase.cs ├── OSharp.UnitTest.Infrastructure.csproj ├── TestEntity.cs └── TestStartup.cs /.dockerignore: -------------------------------------------------------------------------------- 1 | **/.classpath 2 | **/.dockerignore 3 | **/.env 4 | **/.git 5 | **/.gitignore 6 | **/.project 7 | **/.settings 8 | **/.toolstarget 9 | **/.vs 10 | **/.vscode 11 | **/*.*proj.user 12 | **/*.dbmdl 13 | **/*.jfm 14 | **/azds.yaml 15 | **/bin 16 | **/charts 17 | **/docker-compose* 18 | **/Dockerfile* 19 | **/node_modules 20 | **/npm-debug.log 21 | **/obj 22 | **/secrets.dev.yaml 23 | **/values.dev.yaml 24 | LICENSE 25 | README.md -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | #缩进风格:空格 6 | indent_style = space 7 | #缩进大小2 8 | indent_size = 4 9 | #换行符lf 10 | end_of_line = lf 11 | #字符集utf-8 12 | charset = utf-8 13 | #是否删除行尾的空格 14 | trim_trailing_whitespace = true 15 | #是否在文件的最后插入一个空行 16 | insert_final_newline = true 17 | 18 | [*.{xaml,json,csproj,cshtml,yml}] 19 | indent_size = 2 20 | 21 | [*.md] 22 | trim_trailing_whitespace = false 23 | 24 | [Makefile] 25 | indent_style = tab 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/-----.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 新功能请求 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## 您的功能请求与现有问题有关吗?请描述 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | ## 描述您想要的需求方案 14 | A clear and concise description of what you want to happen. 15 | 16 | ## 描述你考虑过的解决方案 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | ## 附加上下文,比如截图 20 | Add any other context or screenshots about the feature request here. 21 | 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/--bug.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 报告BUG 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### 描述一下BUG 11 | A clear and concise description of what the bug is. 12 | 13 | ### 重现步骤 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | ### 期望行为 21 | A clear and concise description of what you expected to happen. 22 | 23 | ### 附加上下文,如截图 24 | Add any other context about the problem here. 25 | 26 | ### 运行环境 27 | 28 | **Desktop (please complete the following information):** 29 | - Version [e.g. 22] 30 | - OS: [e.g. iOS] 31 | - Browser [e.g. chrome, safari] 32 | -------------------------------------------------------------------------------- /OSharpNS.nuspec: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /build/OSharp.Keys.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/build/OSharp.Keys.snk -------------------------------------------------------------------------------- /build/apicleaner.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/build/apicleaner.exe -------------------------------------------------------------------------------- /build/docs-build.bat: -------------------------------------------------------------------------------- 1 | docfx metadata ../osharp.sln 2 | apicleaner.exe _api 3 | docfx docfx.json 4 | docfx serve _site -------------------------------------------------------------------------------- /build/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/build/icon.png -------------------------------------------------------------------------------- /build/nuget-delete.ps1: -------------------------------------------------------------------------------- 1 | $version = Read-Host "请输入要删除的版本号" 2 | $props = @( 3 | "OSharp.Core", "OSharp.AspNetCore", "OSharp.Authorization.Datas", "OSharp.Authorization.Functions", "OSharp.AutoMapper", 4 | "OSharp.EntityFrameworkCore", "OSharp.EntityFrameworkCore.MySql", "OSharp.EntityFrameworkCore.Oracle", 5 | "OSharp.EntityFrameworkCore.PostgreSql", "OSharp.EntityFrameworkCore.Sqlite", "OSharp.EntityFrameworkCore.SqlServer", 6 | "OSharp.Exceptionless", "OSharp.Hangfire", "OSharp.Hosting.Apis", "OSharp.Hosting.Core", "OSharp.Hosting.EntityConfiguration", 7 | "OSharp.Identity", "OSharp.Log4Net", "OSharp.MiniProfiler", "OSharp.Redis", "OSharp.Swagger", "OSharp.Utils", "OSharp.Wpf", "OSharp", 8 | "OSharp.Template.Mvc_Angular", "OSharp.CodeGeneration" 9 | ) 10 | foreach($prop in $props) 11 | { 12 | nuget delete $prop $version -src "https://www.nuget.org" -NonInteractive 13 | # nuget delete $prop $version -Source "http://nuget.66soft.net/nuget" -NonInteractive 14 | } 15 | -------------------------------------------------------------------------------- /build/nuget.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/build/nuget.exe -------------------------------------------------------------------------------- /build/version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9.0 4 | 0 5 | -preview. 6 | 306 7 | $(VersionMain).$(VersionPrefix)$(VersionSuffix)$(VersionSuffixVersion) 8 | $(VersionMain).$(VersionPrefix).$(VersionSuffixVersion) 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | #缩进风格:空格 6 | indent_style = space 7 | #缩进大小2 8 | indent_size = 4 9 | #换行符lf 10 | end_of_line = lf 11 | #字符集utf-8 12 | charset = utf-8 13 | #是否删除行尾的空格 14 | trim_trailing_whitespace = true 15 | #是否在文件的最后插入一个空行 16 | insert_final_newline = true 17 | 18 | [*.{xaml,json,csproj,cshtml,yml}] 19 | indent_size = 2 20 | 21 | [.pages] 22 | indent_size = 2 23 | 24 | [*.md] 25 | trim_trailing_whitespace = false 26 | 27 | [Makefile] 28 | indent_style = space 29 | -------------------------------------------------------------------------------- /docs/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "yaml.schemas": { 3 | "https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /docs/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gmf520/mkdocs-material as build 2 | COPY . /docs 3 | RUN mkdocs build 4 | 5 | FROM nginx as final 6 | WORKDIR /usr/share/nginx/html 7 | COPY --from=build /docs/site . 8 | EXPOSE 80 9 | -------------------------------------------------------------------------------- /docs/build.ps1: -------------------------------------------------------------------------------- 1 | $version = Read-Host "请输入版本号" 2 | docker build -t gmf520/osharp.docs:$version . 3 | docker tag gmf520/osharp.docs:$version gmf520/osharp.docs:latest 4 | Write-Host "构建完成: gmf520/osharp.docs:$version" 5 | Write-Host "即将发布到dockerhub, 请输入账号密码" 6 | $username = Read-Host "请输入账号" 7 | $password = Read-Host "请输入密码" 8 | docker login -u $username -p $password 9 | docker push gmf520/osharp.docs:$version 10 | docker push gmf520/osharp.docs:latest 11 | Write-Host "发布完成: gmf520/osharp.docs:$version" -------------------------------------------------------------------------------- /docs/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM squidfunk/mkdocs-material 2 | 3 | RUN pip install mkdocs-minify-plugin \ 4 | mkdocs-glightbox \ 5 | mkdocs-awesome-pages-plugin 6 | 7 | WORKDIR /docs 8 | EXPOSE 80 9 | 10 | ENTRYPOINT ["mkdocs"] 11 | CMD ["serve", "--dev-addr=0.0.0.0:80"] 12 | -------------------------------------------------------------------------------- /docs/docker/build.ps1: -------------------------------------------------------------------------------- 1 | $version = Read-Host "请输入版本号" 2 | docker build -t gmf520/mkdocs-material:$version . 3 | docker tag gmf520/mkdocs-material:$version gmf520/mkdocs-material:latest 4 | Write-Host "构建完成: gmf520/mkdocs-material:$version" 5 | Write-Host "即将发布到dockerhub, 请输入账号密码" 6 | $username = Read-Host "请输入账号" 7 | $password = Read-Host "请输入密码" 8 | docker login -u $username -p $password 9 | docker push gmf520/mkdocs-material:$version 10 | docker push gmf520/mkdocs-material:latest 11 | Write-Host "发布完成: gmf520/mkdocs-material:$version" -------------------------------------------------------------------------------- /docs/docs/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - 首页: index.md 3 | - 快速上手: quick 4 | - 设计详解: explain 5 | - 视频教程: video 6 | - API文档: api 7 | - 常见问题: faq 8 | - 关于: about 9 | -------------------------------------------------------------------------------- /docs/docs/about/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - update-logs.md 4 | - licence.md 5 | -------------------------------------------------------------------------------- /docs/docs/about/index.md: -------------------------------------------------------------------------------- 1 | # 关于OSharp 2 | ![展示图](../assets/imgs/01.jpg){.img-fluid tag=1 title="展示图"} -------------------------------------------------------------------------------- /docs/docs/about/licence.md: -------------------------------------------------------------------------------- 1 | # Licence -------------------------------------------------------------------------------- /docs/docs/about/update-logs.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/about/update-logs.md -------------------------------------------------------------------------------- /docs/docs/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/favicon.ico -------------------------------------------------------------------------------- /docs/docs/assets/imgs/01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/01.jpg -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/identity/jwt/jwt-refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/identity/jwt/jwt-refresh.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/intro/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/intro/001.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/intro/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/intro/002.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/intro/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/intro/003.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/intro/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/intro/004.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/intro/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/intro/005.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/intro/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/intro/006.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/001.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/001.gif -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/002.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/003.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/004.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/005.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/006.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/007.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/start/008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/start/008.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/001.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/002.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/003.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/003.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/004.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/004.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/005.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/005.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/006.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/006.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/007.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/007.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/008.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/008.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/009.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/010.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/010.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/011.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/011.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/012.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/012.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/013.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/controller/014.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/controller/014.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/entity/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/entity/001.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/entity/002.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/entity/002.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/ng-module/001.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/ng-module/001.gif -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/ng-module/002.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/ng-module/002.gif -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/ng-module/003.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/ng-module/003.gif -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/ng-module/004.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/ng-module/004.gif -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/ng-module/10days.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/ng-module/10days.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/ng-module/11user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/ng-module/11user.png -------------------------------------------------------------------------------- /docs/docs/assets/imgs/quick/steps/service/001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/docs/docs/assets/imgs/quick/steps/service/001.png -------------------------------------------------------------------------------- /docs/docs/assets/js/custom.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | let productImageGroups = []; 3 | $('.img-fluid').each(function () { 4 | let productImageSource = $(this).attr('src'); 5 | let productImageTag = $(this).attr('tag'); 6 | let productImageTitle = $(this).attr('title'); 7 | if (productImageTitle) { 8 | productImageTitle = 'title="' + productImageTitle + '" '; 9 | } else { 10 | productImageTitle = ''; 11 | } 12 | $(this). 13 | wrap(''); 15 | productImageGroups.push('.' + productImageTag); 16 | }); 17 | jQuery.unique(productImageGroups); 18 | productImageGroups.forEach(productImageGroupsSet); 19 | 20 | function productImageGroupsSet(value) { 21 | $(value).simpleLightbox(); 22 | } 23 | }) -------------------------------------------------------------------------------- /docs/docs/explain/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - overall-design.md 4 | - startup.md 5 | - 功能模块剖析: packs 6 | - 功能服务剖析: services -------------------------------------------------------------------------------- /docs/docs/explain/index.md: -------------------------------------------------------------------------------- 1 | # 设计详解概述 -------------------------------------------------------------------------------- /docs/docs/explain/overall-design.md: -------------------------------------------------------------------------------- 1 | # OSharp总体设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - core.md 4 | - dependency.md 5 | - eventbus.md 6 | - aspnetcore.md 7 | - automapper.md 8 | - EFCore模块: efcore 9 | - redis.md 10 | - entityinfo.md 11 | - mvc-function.md 12 | - identity.md 13 | - aspnetcore-mvc.md 14 | - signalr.md 15 | - hangfire.md 16 | - 权限安全模块: auth 17 | -------------------------------------------------------------------------------- /docs/docs/explain/packs/aspnetcore-mvc.md: -------------------------------------------------------------------------------- 1 | # MVC模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/aspnetcore.md: -------------------------------------------------------------------------------- 1 | # AspNetCore模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/auth/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - function-auth.md 4 | - data-auth.md 5 | -------------------------------------------------------------------------------- /docs/docs/explain/packs/auth/data-auth.md: -------------------------------------------------------------------------------- 1 | # 数据权限设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/auth/function-auth.md: -------------------------------------------------------------------------------- 1 | # 功能权限设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/auth/index.md: -------------------------------------------------------------------------------- 1 | # 权限安全概述 -------------------------------------------------------------------------------- /docs/docs/explain/packs/automapper.md: -------------------------------------------------------------------------------- 1 | # AutoMapper模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/core.md: -------------------------------------------------------------------------------- 1 | # 核心模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/dependency.md: -------------------------------------------------------------------------------- 1 | # 依赖注入模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - entity-repository.md 4 | - dbcontext.md 5 | - unitofwork-transaction.md 6 | - migration.md 7 | - database-provider.md 8 | -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/database-provider.md: -------------------------------------------------------------------------------- 1 | # 各数据驱动应用 -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/dbcontext.md: -------------------------------------------------------------------------------- 1 | # 数据上下文设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/entity-repository.md: -------------------------------------------------------------------------------- 1 | # 实体/仓储设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/index.md: -------------------------------------------------------------------------------- 1 | # EFCore模块概述 -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/migration.md: -------------------------------------------------------------------------------- 1 | # 数据迁移 -------------------------------------------------------------------------------- /docs/docs/explain/packs/efcore/unitofwork-transaction.md: -------------------------------------------------------------------------------- 1 | # 工作单元/事务设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/entityinfo.md: -------------------------------------------------------------------------------- 1 | # 数据实体模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/eventbus.md: -------------------------------------------------------------------------------- 1 | # 事件总线模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/hangfire.md: -------------------------------------------------------------------------------- 1 | # Hangfire模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/identity.md: -------------------------------------------------------------------------------- 1 | # 身份认证模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/index.md: -------------------------------------------------------------------------------- 1 | # 模块系统设计 -------------------------------------------------------------------------------- /docs/docs/explain/packs/mvc-function.md: -------------------------------------------------------------------------------- 1 | # MVC功能点模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/redis.md: -------------------------------------------------------------------------------- 1 | # Redis模块 -------------------------------------------------------------------------------- /docs/docs/explain/packs/signalr.md: -------------------------------------------------------------------------------- 1 | # SignalR模块 -------------------------------------------------------------------------------- /docs/docs/explain/services/caching.md: -------------------------------------------------------------------------------- 1 | # 缓存服务 -------------------------------------------------------------------------------- /docs/docs/explain/services/filter.md: -------------------------------------------------------------------------------- 1 | # 查询服务 -------------------------------------------------------------------------------- /docs/docs/explain/startup.md: -------------------------------------------------------------------------------- 1 | # OSharp启动流程 -------------------------------------------------------------------------------- /docs/docs/faq/index.md: -------------------------------------------------------------------------------- 1 | # 常见问题 -------------------------------------------------------------------------------- /docs/docs/index.md: -------------------------------------------------------------------------------- 1 | # 首页 2 | --- 3 | ## 什么是OSharp 4 | OSharp 全称 OSharp Framework with .NetStandard2.x,是一个基于`.NetStandard2.x`开发的一个`.NetCore`快速开发框架。这个框架使用最新稳定版的`.NetCore SDK`(当前是.NET Core 3.0),对 AspNetCore 的配置、依赖注入、日志、缓存、实体框架、Mvc(WebApi)、身份认证、权限授权等模块进行更高一级的自动化封装,并规范了一套业务实现的代码结构与操作流程,使 .Net Core 框架更易于应用到实际项目开发中。 5 | 6 | [>> 详情](quick/intro.md) -------------------------------------------------------------------------------- /docs/docs/quick/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - intro.md 3 | - start.md 4 | - 步步为营: steps 5 | - 权限系统: permiss 6 | - generator.md 7 | -------------------------------------------------------------------------------- /docs/docs/quick/generator.md: -------------------------------------------------------------------------------- 1 | # 代码生成器 -------------------------------------------------------------------------------- /docs/docs/quick/permiss/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - function-entityinfo-module.md 4 | - role.md 5 | - user.md 6 | - role-entityinfo.md 7 | -------------------------------------------------------------------------------- /docs/docs/quick/permiss/function-entityinfo-module.md: -------------------------------------------------------------------------------- 1 | # 功能,实体,模块管理 -------------------------------------------------------------------------------- /docs/docs/quick/permiss/index.md: -------------------------------------------------------------------------------- 1 | # 权限系统概述 -------------------------------------------------------------------------------- /docs/docs/quick/permiss/role-entityinfo.md: -------------------------------------------------------------------------------- 1 | # 给角色分配数据权限 -------------------------------------------------------------------------------- /docs/docs/quick/permiss/role.md: -------------------------------------------------------------------------------- 1 | # 角色管理 -------------------------------------------------------------------------------- /docs/docs/quick/permiss/user.md: -------------------------------------------------------------------------------- 1 | # 用户管理 -------------------------------------------------------------------------------- /docs/docs/quick/steps/.pages: -------------------------------------------------------------------------------- 1 | nav: 2 | - index.md 3 | - entity.md 4 | - service.md 5 | - controller.md 6 | - ng-module.md 7 | -------------------------------------------------------------------------------- /docs/docs/video/index.md: -------------------------------------------------------------------------------- 1 | # 视频教程概述 -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.100", 4 | "rollForward": "latestFeature", 5 | "allowPrerelease": false 6 | } 7 | } -------------------------------------------------------------------------------- /samples/web/.editorconfig: -------------------------------------------------------------------------------- 1 | # indicate this is the root of the project 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | indent_size = 4 10 | 11 | [*.{html,razor,cshtml,json,js,ts,xml,xaml,css,less,csproj}] 12 | indent_size = 2 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Authorization/Dtos/EntityRoleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-03 23:11 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Authorization.Entities; 11 | 12 | using OSharp.Authorization.Dtos; 13 | using OSharp.Mapping; 14 | 15 | 16 | namespace Liuliu.Demo.Authorization.Dtos 17 | { 18 | /// 19 | /// 输入DTO:实体角色信息 20 | /// 21 | [MapTo(typeof(EntityRole))] 22 | public class EntityRoleInputDto : EntityRoleInputDtoBase 23 | { } 24 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Authorization/Dtos/ModuleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Authorization.Entities; 11 | 12 | using OSharp.Authorization.Dtos; 13 | using OSharp.Mapping; 14 | 15 | 16 | namespace Liuliu.Demo.Authorization.Dtos 17 | { 18 | /// 19 | /// 输入DTO:模块信息 20 | /// 21 | [MapTo(typeof(Module))] 22 | public class ModuleInputDto : ModuleInputDtoBase 23 | { } 24 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Authorization/Dtos/RoleSetModuleDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-08 13:10 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Authorization.Dtos 11 | { 12 | /// 13 | /// 角色设置权限DTO 14 | /// 15 | public class RoleSetModuleDto 16 | { 17 | /// 18 | /// 获取或设置 角色编号 19 | /// 20 | public int RoleId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 要设置的模块编号集合 24 | /// 25 | public int[] ModuleIds { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Authorization/Dtos/UserSetModuleDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-08 12:21 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Authorization.Dtos 11 | { 12 | /// 13 | /// 用户设置模块DTO 14 | /// 15 | public class UserSetModuleDto 16 | { 17 | /// 18 | /// 获取或设置 用户编号 19 | /// 20 | public int UserId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 要设置的模块编号 24 | /// 25 | public int[] ModuleIds { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Authorization/Dtos/UserSetRoleDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-08 12:21 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Authorization.Dtos 11 | { 12 | /// 13 | /// 用户设置角色DTO 14 | /// 15 | public class UserSetRoleDto 16 | { 17 | /// 18 | /// 获取或设置 用户编号 19 | /// 20 | public int UserId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 要设置的角色编号 24 | /// 25 | public int[] RoleIds { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Common/Dtos/ListNode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/web/Liuliu.Demo.Core/Common/Dtos/ListNode.cs -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Common/ICommonContract.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-03 12:59 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Common 11 | { 12 | /// 13 | /// 业务契约:通用业务 14 | /// 15 | public interface ICommonContract 16 | { 17 | /// 18 | /// 测试测试 19 | /// 20 | string Test(); 21 | } 22 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Dtos/RoleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Identity.Entities; 11 | 12 | using OSharp.Identity.Dtos; 13 | using OSharp.Mapping; 14 | 15 | 16 | namespace Liuliu.Demo.Identity.Dtos 17 | { 18 | /// 19 | /// 输入DTO:角色信息 20 | /// 21 | [MapTo(typeof(Role))] 22 | public class RoleInputDto : RoleInputDtoBase 23 | { } 24 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Dtos/UserInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Identity.Entities; 11 | 12 | using OSharp.Identity.Dtos; 13 | using OSharp.Mapping; 14 | 15 | 16 | namespace Liuliu.Demo.Identity.Dtos 17 | { 18 | /// 19 | /// 输入DTO:用户信息 20 | /// 21 | [MapTo(typeof(User))] 22 | public class UserInputDto : UserInputDtoBase 23 | { } 24 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Dtos/UserRoleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using System; 11 | 12 | using Liuliu.Demo.Identity.Entities; 13 | 14 | using OSharp.Identity.Dtos; 15 | using OSharp.Mapping; 16 | 17 | 18 | namespace Liuliu.Demo.Identity.Dtos 19 | { 20 | /// 21 | /// 输入DTO:用户角色信息 22 | /// 23 | [MapTo(typeof(UserRole))] 24 | public class UserRoleInputDto : UserRoleInputDtoBase 25 | { } 26 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Entities/RoleClaim.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.ComponentModel; 11 | 12 | using OSharp.Identity.Entities; 13 | 14 | 15 | namespace Liuliu.Demo.Identity.Entities 16 | { 17 | /// 18 | /// 实体类:角色声明信息 19 | /// 20 | [Description("角色声明信息")] 21 | public class RoleClaim : RoleClaimBase 22 | { 23 | /// 24 | /// 获取或设置 所属角色信息 25 | /// 26 | public virtual Role Role { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Entities/UserClaim.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.ComponentModel; 11 | 12 | using OSharp.Identity.Entities; 13 | 14 | 15 | namespace Liuliu.Demo.Identity.Entities 16 | { 17 | /// 18 | /// 实体类:用户声明信息 19 | /// 20 | [Description("用户声明信息")] 21 | public class UserClaim : UserClaimBase 22 | { 23 | /// 24 | /// 获取或设置 所属用户 25 | /// 26 | public virtual User User { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Entities/UserLogin.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using System; 11 | using System.ComponentModel; 12 | 13 | using OSharp.Identity.Entities; 14 | 15 | 16 | namespace Liuliu.Demo.Identity.Entities 17 | { 18 | /// 19 | /// 实体类:用户登录及其提供程序 20 | /// 21 | [Description("用户登录及其提供程序")] 22 | public class UserLogin : UserLoginBase 23 | { 24 | /// 25 | /// 获取或设置 所属用户信息 26 | /// 27 | public virtual User User { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Entities/UserToken.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using System; 11 | using System.ComponentModel; 12 | 13 | using OSharp.Identity.Entities; 14 | 15 | 16 | namespace Liuliu.Demo.Identity.Entities 17 | { 18 | /// 19 | /// 实体类:用户的身份认证令牌 20 | /// 21 | [Description("用户的身份认证令牌")] 22 | public class UserToken : UserTokenBase 23 | { 24 | /// 25 | /// 获取或设置 所属用户信息 26 | /// 27 | public virtual User User { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Identity/Events/LogoutEventData.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.EventBuses; 11 | 12 | 13 | namespace Liuliu.Demo.Identity.Events 14 | { 15 | /// 16 | /// 用户退出事件数据 17 | /// 18 | public class LogoutEventData : EventDataBase 19 | { 20 | /// 21 | /// 获取或设置 用户编号 22 | /// 23 | public int UserId { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Infos/Dtos/MessageInputDto.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | 4 | namespace Liuliu.Demo.Infos.Dtos 5 | { 6 | public partial class MessageInputDto 7 | { 8 | /// 9 | /// 获取或设置 公共消息的接收角色编号集合 10 | /// 11 | public ICollection PublicRoleIds { get; set; } 12 | 13 | /// 14 | /// 获取或设置 私人消息的接收者编号集合 15 | /// 16 | public ICollection RecipientIds { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Infos/Entities/Message.cs: -------------------------------------------------------------------------------- 1 | using OSharp.Entity; 2 | 3 | 4 | namespace Liuliu.Demo.Infos.Entities 5 | { 6 | [TableNamePrefix("Infos")] 7 | public partial class Message 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Infos/Entities/MessageReceive.cs: -------------------------------------------------------------------------------- 1 | using OSharp.Entity; 2 | 3 | 4 | namespace Liuliu.Demo.Infos.Entities 5 | { 6 | [TableNamePrefix("Infos")] 7 | public partial class MessageReceive 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Infos/Entities/MessageReply.cs: -------------------------------------------------------------------------------- 1 | using OSharp.Entity; 2 | 3 | 4 | namespace Liuliu.Demo.Infos.Entities 5 | { 6 | [TableNamePrefix("Infos")] 7 | public partial class MessageReply 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Infos/Events/MessageCreatedEventData.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-15 9:27 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Infos.Entities; 11 | 12 | using OSharp.EventBuses; 13 | 14 | 15 | namespace Liuliu.Demo.Infos.Events 16 | { 17 | /// 18 | /// 事件数据:发送消息 19 | /// 20 | public class MessageCreatedEventData : EventDataBase 21 | { 22 | /// 23 | /// 获取或设置 新增的消息 24 | /// 25 | public Message[] Messages { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Systems/Dtos/GenerateCodeInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-06 22:37 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Systems.Dtos 11 | { 12 | /// 13 | /// 代码生成输入DTO 14 | /// 15 | public class GenerateCodeInputDto 16 | { } 17 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Systems/Dtos/PackOutputDto.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/web/Liuliu.Demo.Core/Systems/Dtos/PackOutputDto.cs -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Systems/Dtos/SystemSetting.cs: -------------------------------------------------------------------------------- 1 |  2 | using OSharp.Core.Systems; 3 | 4 | 5 | namespace Liuliu.Demo.Systems.Dtos 6 | { 7 | /// 8 | /// 系统设置项 9 | /// 10 | public class SystemSetting : ISetting 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Systems/ISystemsContract.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-08 13:38 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Systems 11 | { 12 | /// 13 | /// 业务契约:系统模块 14 | /// 15 | public interface ISystemsContract 16 | { 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Core/Systems/SystemsService.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-08 13:37 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace Liuliu.Demo.Systems 11 | { 12 | /// 13 | /// 业务实现:系统模块 14 | /// 15 | public class SystemsService 16 | { } 17 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.EntityConfiguration/Liuliu.Demo.EntityConfiguration.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Web/Areas/Admin/Controllers/AdminApiController.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:50 8 | // ----------------------------------------------------------------------- 9 | 10 | using System; 11 | 12 | using OSharp.AspNetCore.Mvc; 13 | using OSharp.Authorization; 14 | 15 | 16 | namespace Liuliu.Demo.Web.Areas.Admin.Controllers 17 | { 18 | [AreaInfo("Admin", Display = "管理")] 19 | [RoleLimit] 20 | [ApiAuthorize] 21 | public abstract class AdminApiController : AreaApiControllerBase 22 | { } 23 | } 24 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Web/Controllers/SiteApiControllerBase.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-03-07 1:12 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.ComponentModel; 11 | 12 | using Microsoft.AspNetCore.Authorization; 13 | 14 | using OSharp.AspNetCore.Mvc; 15 | using OSharp.Authorization; 16 | 17 | 18 | namespace Liuliu.Demo.Web.Controllers 19 | { 20 | [DisplayName("网站")] 21 | [ApiAuthorize] 22 | public abstract class SiteApiControllerBase : ApiControllerBase 23 | { } 24 | } 25 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Web/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.2-aspnetcore-runtime AS base 2 | MAINTAINER LiuliuSoft i66soft@qq.com 3 | 4 | WORKDIR /app 5 | EXPOSE 80 6 | 7 | COPY ./bin/Release/netcoreapp2.2/publish /app 8 | ENTRYPOINT ["dotnet", "Liuliu.Demo.Web.dll"] -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Web/Program.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2022 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2022-11-10 13:47 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Web; 11 | 12 | var builder = WebApplication.CreateBuilder(args); 13 | 14 | Startup startup = new Startup(); 15 | startup.ConfigureServices(builder.Services); 16 | 17 | var app = builder.Build(); 18 | startup.Configure(app); 19 | app.Run(); -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Web/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:7001/", 7 | "sslPort": 0 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "launchUrl": "swagger/index.html", 15 | "environmentVariables": { 16 | "ASPNETCORE_ENVIRONMENT": "Development" 17 | } 18 | }, 19 | "Liuliu.Demo.Web": { 20 | "commandName": "Project", 21 | "launchBrowser": true, 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development" 24 | }, 25 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.Web/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": true, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Warning", 8 | "OSharp": "Debug", 9 | "Liuliu": "Debug" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.WebApi/.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-ef": { 6 | "version": "7.0.0", 7 | "commands": [ 8 | "dotnet-ef" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.WebApi/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | using OSharp.Hosting.Apis.Controllers; 4 | 5 | 6 | namespace Liuliu.Demo.Web.Controllers 7 | { 8 | [Description("网站-主页")] 9 | public class HomeController : SiteApiControllerBase 10 | { 11 | /// 12 | /// 初始化一个类型的新实例 13 | /// 14 | public HomeController(IServiceProvider provider) 15 | : base(provider) 16 | { } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/web/Liuliu.Demo.WebApi/Program.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2022 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2022-11-10 13:47 8 | // ----------------------------------------------------------------------- 9 | 10 | using Liuliu.Demo.Web; 11 | 12 | var builder = WebApplication.CreateBuilder(args); 13 | 14 | Startup startup = new Startup(); 15 | startup.ConfigureServices(builder.Services); 16 | 17 | var app = builder.Build(); 18 | startup.Configure(app); 19 | app.Run(); -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGeneration/Generates/MetadataType.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-04-08 21:39 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.CodeGeneration.Generates 11 | { 12 | /// 13 | /// 表示生成代码需要的元数据类型,有实体和模块 14 | /// 15 | public enum MetadataType 16 | { 17 | Entity, 18 | 19 | Module, 20 | 21 | Project 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | [assembly: ThemeInfo( 4 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 5 | //(used if a resource is not found in the page, 6 | // or application resource dictionaries) 7 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 8 | //(used if a resource is not found in the page, 9 | // app, or any theme specific resource dictionaries) 10 | )] 11 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Migrations/20210412033738_RootPath.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace OSharp.CodeGenerator.Migrations 4 | { 5 | public partial class RootPath : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "RootPath", 11 | table: "CodeGen_CodeProject", 12 | type: "TEXT", 13 | maxLength: 200, 14 | nullable: true); 15 | } 16 | 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | migrationBuilder.DropColumn( 20 | name: "RootPath", 21 | table: "CodeGen_CodeProject"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Migrations/20220113165940_IsEnum.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace OSharp.CodeGenerator.Migrations 6 | { 7 | public partial class IsEnum : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "IsEnum", 13 | table: "CodeGen_CodeProperty", 14 | type: "INTEGER", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "IsEnum", 23 | table: "CodeGen_CodeProperty"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Migrations/20220121031306_Prop_Listable.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace OSharp.CodeGenerator.Migrations 6 | { 7 | public partial class Prop_Listable : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "Listable", 13 | table: "CodeGen_CodeProperty", 14 | type: "INTEGER", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "Listable", 23 | table: "CodeGen_CodeProperty"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Migrations/20220122045133_IsHide.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace OSharp.CodeGenerator.Migrations 6 | { 7 | public partial class IsHide : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "IsHide", 13 | table: "CodeGen_CodeProperty", 14 | type: "INTEGER", 15 | nullable: false, 16 | defaultValue: false); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "IsHide", 23 | table: "CodeGen_CodeProperty"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Resources/osharp128-2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/wpf/OSharp.CodeGenerator/Resources/osharp128-2.ico -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Resources/osharp128-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/wpf/OSharp.CodeGenerator/Resources/osharp128-2.png -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Resources/osharp128.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/wpf/OSharp.CodeGenerator/Resources/osharp128.ico -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Resources/osharp128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/wpf/OSharp.CodeGenerator/Resources/osharp128.png -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Templates/CustomTemplate001.cshtml: -------------------------------------------------------------------------------- 1 | @inherits MiniRazor.TemplateBase 2 | @namespace OSharp.CodeGeneration.Templates 3 | @using System; 4 | @using System.Linq; 5 | @using OSharp.CodeGeneration.Services.Entities 6 | @using OSharp.CodeGeneration.Utils 7 | @using OSharp.Collections; 8 | @using OSharp.Exceptions; 9 | @using OSharp.Extensions; 10 | @{ 11 | CodeProject project = Model; 12 | } 13 | 项目信息: 14 | 名称:@project.Name 15 | 命名空间:@project.NamespacePrefix 16 | 17 | 项目模块: 18 | @foreach (var module in project.Modules) 19 | { 20 | 21 | @module.Name - @module.Display 22 | foreach (var entity in module.Entities) 23 | { 24 | 25 | @entity.Name - @entity.Display 26 | foreach (var property in entity.Properties) 27 | { 28 | 29 | @property.Name - @property.Display 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Entities/EntityListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Entities 17 | { 18 | /// 19 | /// EntityListView.xaml 的交互逻辑 20 | /// 21 | public partial class EntityListView : UserControl 22 | { 23 | public EntityListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Entities/ForeignListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Entities 17 | { 18 | /// 19 | /// ForeignListView.xaml 的交互逻辑 20 | /// 21 | public partial class ForeignListView : UserControl 22 | { 23 | public ForeignListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Helps/AboutView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Helps 17 | { 18 | /// 19 | /// AboutView.xaml 的交互逻辑 20 | /// 21 | public partial class AboutView : UserControl 22 | { 23 | public AboutView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/LoadFromEntities/LoadFromEntitiesView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.LoadFromEntities 17 | { 18 | /// 19 | /// LoadFromEntitiesView.xaml 的交互逻辑 20 | /// 21 | public partial class LoadFromEntitiesView : UserControl 22 | { 23 | public LoadFromEntitiesView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/MenuView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views 17 | { 18 | /// 19 | /// NavView.xaml 的交互逻辑 20 | /// 21 | public partial class MenuView : UserControl 22 | { 23 | public MenuView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Modules/ModuleListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Modules 17 | { 18 | /// 19 | /// ModuleListView.xaml 的交互逻辑 20 | /// 21 | public partial class ModuleListView : UserControl 22 | { 23 | public ModuleListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Projects/ProjectEditView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Projects 17 | { 18 | /// 19 | /// ProjectEditView.xaml 的交互逻辑 20 | /// 21 | public partial class ProjectEditView : UserControl 22 | { 23 | public ProjectEditView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Projects/ProjectListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Projects 17 | { 18 | /// 19 | /// ProjectListView.xaml 的交互逻辑 20 | /// 21 | public partial class ProjectListView : UserControl 22 | { 23 | public ProjectListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Properties/PropertyListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Properties 17 | { 18 | /// 19 | /// PropertyListView.xaml 的交互逻辑 20 | /// 21 | public partial class PropertyListView : UserControl 22 | { 23 | public PropertyListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/StatusBarViewModel.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-05-04 11:32 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Wpf.Stylet; 11 | 12 | using Stylet; 13 | 14 | 15 | namespace OSharp.CodeGenerator.Views 16 | { 17 | [Singleton] 18 | public class StatusBarViewModel : Screen 19 | { 20 | /// 21 | /// 获取或设置 状态栏消息 22 | /// 23 | public string Message { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/StatusbarView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/StatusbarView.xaml.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-05-04 11:27 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.Windows.Controls; 11 | 12 | 13 | namespace OSharp.CodeGenerator.Views 14 | { 15 | /// 16 | /// StatusBarView.xaml 的交互逻辑 17 | /// 18 | public partial class StatusBarView 19 | { 20 | public StatusBarView() 21 | { 22 | InitializeComponent(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/Views/Templates/TemplateListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace OSharp.CodeGenerator.Views.Templates 17 | { 18 | /// 19 | /// TemplateListView.xaml 的交互逻辑 20 | /// 21 | public partial class TemplateListView : UserControl 22 | { 23 | public TemplateListView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Warning" 7 | } 8 | }, 9 | "OSharp": { 10 | "DbContexts": { 11 | "Sqlite": { 12 | "DbContextTypeName": "OSharp.Entity.DefaultDbContext,OSharp.EntityFrameworkCore", 13 | "ConnectionString": "data source=osharp-code-generator.db", 14 | "DatabaseType": "Sqlite", 15 | "LazyLoadingProxiesEnabled": true, 16 | "AuditEntityEnabled": true, 17 | "AutoMigrationEnabled": true 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /samples/wpf/OSharp.CodeGenerator/build/osharp-code-generator.db.bak: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/samples/wpf/OSharp.CodeGenerator/build/osharp-code-generator.db.bak -------------------------------------------------------------------------------- /src/OSharp.AspNetCore.Diagnostics/HealthChecksPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-05 19:39 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.ComponentModel; 11 | 12 | 13 | namespace OSharp.AspNetCore.Diagnostics 14 | { 15 | /// 16 | /// 程序健康检查模块 17 | /// 18 | [Description("HealthChecks模块")] 19 | public class HealthChecksPack : HealthChecksPackBase 20 | { } 21 | } -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/AspOsharpPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2022 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2022-11-10 19:07 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.AspNetCore; 11 | 12 | /// 13 | /// 基于AspNetCore环境的Pack模块基类 14 | /// 15 | public abstract class AspOsharpPack : OsharpPack 16 | { 17 | /// 18 | /// 应用AspNetCore的服务业务 19 | /// 20 | /// Web应用程序 21 | public virtual void UsePack(WebApplication app) 22 | { 23 | IServiceProvider provider = app.Services; 24 | base.UsePack(provider); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/Cors/ICorsInitializer.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-12-13 13:15 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.AspNetCore.Cors; 11 | 12 | /// 13 | /// 定义Cors初始化器 14 | /// 15 | public interface ICorsInitializer 16 | { 17 | /// 18 | /// 添加Cors 19 | /// 20 | IServiceCollection AddCors(IServiceCollection services); 21 | 22 | /// 23 | /// 应用Cors 24 | /// 25 | IApplicationBuilder UseCors(IApplicationBuilder app); 26 | } -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/IMiddleware.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-11-01 21:54 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.AspNetCore; 11 | 12 | /// 13 | /// 按照约定的方式定义一个AspNetCore中间件,而不是使用接口,因为后者在调用时需要将中间件注册到DI才可以用,麻烦了点 14 | /// 15 | public interface IMiddleware 16 | { 17 | /// 18 | /// 执行中间件拦截逻辑 19 | /// 20 | /// Http上下文 21 | /// 22 | Task InvokeAsync(HttpContext context); 23 | } 24 | -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/Mvc/AreaBaseController.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-06-12 18:15 8 | // ----------------------------------------------------------------------- 9 | 10 | using Microsoft.AspNetCore.Mvc; 11 | 12 | using OSharp.AspNetCore.Mvc.Filters; 13 | 14 | 15 | namespace OSharp.AspNetCore.Mvc; 16 | 17 | /// 18 | /// 区域的Mvc控制器基类,配置了操作审计 19 | /// 20 | [AuditOperation] 21 | public abstract class AreaBaseController : Controller 22 | { 23 | /// 24 | /// 获取或设置 日志对象 25 | /// 26 | protected ILogger Logger => HttpContext.RequestServices.GetLogger(GetType()); 27 | } -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/Mvc/BaseController.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-06-12 18:21 8 | // ----------------------------------------------------------------------- 9 | 10 | using Microsoft.AspNetCore.Mvc; 11 | 12 | using OSharp.AspNetCore.Mvc.Filters; 13 | 14 | 15 | namespace OSharp.AspNetCore.Mvc; 16 | 17 | /// 18 | /// Mvc控制器基类,配置了操作审计 19 | /// 20 | [AuditOperation] 21 | public abstract class BaseController : Controller 22 | { 23 | /// 24 | /// 获取或设置 日志对象 25 | /// 26 | protected ILogger Logger => HttpContext.RequestServices.GetLogger(GetType()); 27 | } -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/Mvc/Filters/UnitOfWorkAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-12-03 14:12 8 | // ----------------------------------------------------------------------- 9 | 10 | 11 | namespace OSharp.AspNetCore.Mvc.Filters; 12 | 13 | /// 14 | /// 自动提交工作单元事务 15 | /// 16 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 17 | public class UnitOfWorkAttribute : ServiceFilterAttribute 18 | { 19 | /// 20 | /// 自动提交工作单元事务 21 | /// 22 | public UnitOfWorkAttribute() 23 | : base(typeof(UnitOfWorkImpl)) 24 | { } 25 | } 26 | -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/Mvc/MvcPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-01 2:33 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.AspNetCore.Mvc; 11 | 12 | /// 13 | /// MVC模块 14 | /// 15 | [Description("MVC模块")] 16 | public class MvcPack : MvcPackBase 17 | { } -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/SignalR/ConnectionUser.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-04 20:28 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.AspNetCore.SignalR; 11 | 12 | /// 13 | /// SignalR 连接用户项 14 | /// 15 | public class ConnectionUser 16 | { 17 | /// 18 | /// 获取或设置 用户名 19 | /// 20 | public string UserName { get; set; } 21 | 22 | /// 23 | /// 获取或设置 连接Id集合 24 | /// 25 | public ICollection ConnectionIds { get; set; } = new List(); 26 | } -------------------------------------------------------------------------------- /src/OSharp.AspNetCore/SignalR/SignalRPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-08 20:12 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.AspNetCore.SignalR; 11 | 12 | /// 13 | /// SignalR模块 14 | /// 15 | [Description("SignalR模块")] 16 | public class SignalRPack : SignalRPackBase 17 | { } -------------------------------------------------------------------------------- /src/OSharp.Authorization.Datas/Dtos/EntityInfoInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-11-15 17:26 8 | // ----------------------------------------------------------------------- 9 | 10 | 11 | namespace OSharp.Authorization.Dtos; 12 | 13 | /// 14 | /// 输入DTO:实体信息 15 | /// 16 | [MapTo(typeof(EntityInfo))] 17 | public class EntityInfoInputDto : EntityInfoInputDtoBase 18 | { } 19 | -------------------------------------------------------------------------------- /src/OSharp.Authorization.Datas/OSharp.Authorization.Datas.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.Authorization.Datas 9 | OSharp 数据权限组件 10 | OSharp 数据权限组件,对应用中数据权限进行授权的设计实现 11 | OSharp.Authorization 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/OSharp.Authorization.Functions/Dtos/FunctionInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-11-15 17:25 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.Dtos; 11 | 12 | /// 13 | /// 输入DTO:功能信息 14 | /// 15 | [MapTo(typeof(Function))] 16 | public class FunctionInputDto : FunctionInputDtoBase 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp.Authorization.Functions/FunctionRequirement.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-11 14:07 8 | // ----------------------------------------------------------------------- 9 | 10 | using Microsoft.AspNetCore.Authorization; 11 | 12 | 13 | namespace OSharp.Authorization; 14 | 15 | /// 16 | /// 功能点授权需求 17 | /// 18 | public class FunctionRequirement : IAuthorizationRequirement 19 | { 20 | /// 21 | /// Osharp授权策略名称 22 | /// 23 | public const string OsharpPolicy = "OsharpPolicy"; 24 | } -------------------------------------------------------------------------------- /src/OSharp.Authorization.Functions/OSharp.Authorization.Functions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.Authorization.Functions 9 | OSharp 功能权限组件 10 | OSharp 功能权限组件,API功能权限授权的设计实现 11 | OSharp.Authorization 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/OSharp.AutoMapper/AutoMapperTupleBase.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-04-07 18:29 8 | // ----------------------------------------------------------------------- 9 | 10 | 11 | namespace OSharp.AutoMapper 12 | { 13 | /// 14 | /// AutoMapper映射配置基类 15 | /// 16 | public abstract class AutoMapperTupleBase : Profile, IMapTuple 17 | { 18 | /// 19 | /// 获取 排序 20 | /// 21 | public virtual int Order => 0; 22 | 23 | /// 24 | /// 执行对象映射构造 25 | /// 26 | public abstract void CreateMap(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/OSharp.AutoMapper/OSharp.AutoMapper.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.AutoMapper 9 | OSharp AutoMapper 对象映射组件 10 | OSharp AutoMapper 对象映射组件,封装基于AutoMapper的对象映射实现 11 | OSharp.AutoMapper 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/OSharp.AutoMapper/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Linq.Expressions; 3 | 4 | global using AutoMapper; 5 | 6 | global using Microsoft.Extensions.DependencyInjection; 7 | global using Microsoft.Extensions.DependencyInjection.Extensions; 8 | global using Microsoft.Extensions.Logging; 9 | 10 | global using OSharp.Collections; 11 | global using OSharp.Core.Packs; 12 | global using OSharp.Mapping; 13 | global using OSharp.Reflection; 14 | -------------------------------------------------------------------------------- /src/OSharp.CodeGeneration/IFileWriter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace OSharp.CodeGeneration 6 | { 7 | public class IFileWriter 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/OSharp.CodeGeneration/Schema/EntityMetadata.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp.CodeGeneration/Schema/EntityMetadata.cs -------------------------------------------------------------------------------- /src/OSharp.CodeGeneration/Schema/EnumMetadata.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp.CodeGeneration/Schema/EnumMetadata.cs -------------------------------------------------------------------------------- /src/OSharp.CodeGeneration/Schema/PropertyMetadata.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp.CodeGeneration/Schema/PropertyMetadata.cs -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore.MySql/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Data; 3 | global using System.Data.Common; 4 | 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.EntityFrameworkCore.Infrastructure; 7 | global using Microsoft.Extensions.DependencyInjection; 8 | global using Microsoft.Extensions.Logging; 9 | 10 | global using OSharp.Core.Packs; 11 | global using OSharp.Data; 12 | global using OSharp.Entity.KeyGenerate; 13 | -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore.Oracle/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Data; 3 | global using System.Data.Common; 4 | 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.Extensions.DependencyInjection; 7 | global using Microsoft.Extensions.Logging; 8 | 9 | global using OSharp.Core.Packs; 10 | global using OSharp.Data; 11 | global using OSharp.Entity.KeyGenerate; 12 | -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore.PostgreSql/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Data; 3 | global using System.Data.Common; 4 | 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.Extensions.DependencyInjection; 7 | global using Microsoft.Extensions.Logging; 8 | 9 | global using OSharp.Core.Packs; 10 | global using OSharp.Data; 11 | global using OSharp.Entity.KeyGenerate; 12 | -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore.SqlServer/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Data; 3 | global using System.Data.Common; 4 | 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.EntityFrameworkCore.Infrastructure; 7 | global using Microsoft.Extensions.DependencyInjection; 8 | global using Microsoft.Extensions.Logging; 9 | 10 | global using OSharp.Core.Packs; 11 | global using OSharp.Data; 12 | global using OSharp.Entity.KeyGenerate; 13 | -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore.Sqlite/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Data; 3 | global using System.Data.Common; 4 | 5 | global using Microsoft.EntityFrameworkCore; 6 | global using Microsoft.EntityFrameworkCore.Infrastructure; 7 | global using Microsoft.Extensions.DependencyInjection; 8 | global using Microsoft.Extensions.Logging; 9 | 10 | global using OSharp.Core.Packs; 11 | global using OSharp.Data; 12 | global using OSharp.Entity.KeyGenerate; 13 | -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore/Defaults/DefaultDbContext.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-03-08 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 默认EntityFramework数据上下文 14 | /// 15 | public class DefaultDbContext : DbContextBase 16 | { 17 | /// 18 | /// 初始化一个类型的新实例 19 | /// 20 | public DefaultDbContext(DbContextOptions options, IServiceProvider serviceProvider) 21 | : base(options, serviceProvider) 22 | { } 23 | } -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore/IAuditEntityProvider.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-03-08 4:29 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义数据审计信息提供者 14 | /// 15 | public interface IAuditEntityProvider 16 | { 17 | /// 18 | /// 从指定上下文中获取数据审计信息 19 | /// 20 | /// 数据上下文 21 | /// 数据审计信息的集合 22 | IEnumerable GetAuditEntities(DbContext context); 23 | } -------------------------------------------------------------------------------- /src/OSharp.EntityFrameworkCore/IEntityDateTimeUtcConversion.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-08-26 23:37 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 实体时间属性UTC转换器 14 | /// 15 | public interface IEntityDateTimeUtcConversion 16 | { 17 | /// 18 | /// 转换指定的实体类型。 19 | /// 20 | /// 实体类型 21 | void Convert(IMutableEntityType entityType); 22 | } -------------------------------------------------------------------------------- /src/OSharp.Exceptionless/ExceptionlessPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-02-28 1:49 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Exceptionless 11 | { 12 | /// 13 | /// Exceptionless分布式异常日志模块 14 | /// 15 | [Description("Exceptionless分布式异常日志模块")] 16 | public class ExceptionlessPack : ExceptionlessPackCore 17 | { } 18 | } 19 | -------------------------------------------------------------------------------- /src/OSharp.Exceptionless/OSharp.Exceptionless.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.Exceptionless 9 | OSharp Exceptionless 分布式日志组件 10 | OSharp Exceptionless 分布式日志组件,封装基于Exceptionless 分布式日志记录实现 11 | OSharp.Exceptionless 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/OSharp.Exceptionless/README.md: -------------------------------------------------------------------------------- 1 | # Exceptionless分布式异常日志模块 2 | 3 | 此模块用于记录异常信息到`Exceptionless`服务器(可以是官方服务器或者自部属服务器)中 4 | 5 | ## 使用方法 6 | 7 | 1. 通过nuget引用 `OSharp.Exceptionless` 程序集 8 | > Install-Package OSharp.Exceptionless 9 | 10 | 2. 在 `appsettings.json` 中添加如下配置节点 11 | ``` 12 | { 13 | "OSharp": { 14 | "Exceptionless": { 15 | "ApiKey": "你的ApiKey", 16 | "ServerUrl": null, 17 | "Enabled": true 18 | } 19 | } 20 | } 21 | ``` 22 | 配置说明: 23 | * ApiKey不能为空, 24 | * 如果使用官方服务器,`ServerUrl`保持为`null`即可,如果使用自部属的服务器,则改为服务器地址 25 | 26 | 3. 如果要禁用该模块,设置`Enabled: false`即可 27 | -------------------------------------------------------------------------------- /src/OSharp.Exceptionless/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | 3 | global using Exceptionless; 4 | 5 | global using Microsoft.AspNetCore.Builder; 6 | global using Microsoft.Extensions.Configuration; 7 | global using Microsoft.Extensions.DependencyInjection; 8 | global using Microsoft.Extensions.Logging; 9 | 10 | global using OSharp.AspNetCore; 11 | global using OSharp.Core.Packs; 12 | global using OSharp.Exceptions; 13 | global using OSharp.Extensions; 14 | -------------------------------------------------------------------------------- /src/OSharp.Hangfire/HangfirePack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-12-20 12:53 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hangfire; 11 | 12 | /// 13 | /// Hangfire 后台任务模块 14 | /// 15 | [Description("Hangfire后台任务模块")] 16 | public class HangfirePack : HangfirePackBase 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp.Hangfire/IHangfireJobRunner.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-02 16:17 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hangfire; 11 | 12 | /// 13 | /// Hangfire作业运行器 14 | /// 15 | public interface IHangfireJobRunner 16 | { 17 | /// 18 | /// 开始运行 19 | /// 20 | void Start(); 21 | } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hangfire/OSharp.Hangfire.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.Hangfire 9 | OSharp Hangfire 后台任务组件 10 | OSharp Hangfire 后台任务组件,封装基于Hangfire后台任务的服务端实现 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/OSharp.Hangfire/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Security.Claims; 3 | 4 | global using Hangfire; 5 | global using Hangfire.AspNetCore; 6 | global using Hangfire.Dashboard; 7 | global using Hangfire.MemoryStorage; 8 | 9 | global using Microsoft.AspNetCore.Builder; 10 | global using Microsoft.AspNetCore.Http; 11 | global using Microsoft.Extensions.Configuration; 12 | global using Microsoft.Extensions.DependencyInjection; 13 | global using Microsoft.Extensions.Logging; 14 | 15 | global using OSharp.AspNetCore; 16 | global using OSharp.Core.Packs; 17 | global using OSharp.Extensions; 18 | global using OSharp.Identity; 19 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Dtos/EntityRoleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-03 23:11 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Authorization.Dtos; 11 | using OSharp.Hosting.Authorization.Entities; 12 | 13 | 14 | namespace OSharp.Hosting.Authorization.Dtos; 15 | 16 | /// 17 | /// 输入DTO:实体角色信息 18 | /// 19 | [MapTo(typeof(EntityRole))] 20 | public class EntityRoleInputDto : EntityRoleInputDtoBase 21 | { } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Dtos/ModuleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Authorization.Dtos; 11 | using OSharp.Hosting.Authorization.Entities; 12 | 13 | 14 | namespace OSharp.Hosting.Authorization.Dtos; 15 | 16 | /// 17 | /// 输入DTO:模块信息 18 | /// 19 | [MapTo(typeof(Module))] 20 | public class ModuleInputDto : ModuleInputDtoBase 21 | { } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Dtos/ModuleSetFunctionDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Authorization.Dtos; 11 | 12 | /// 13 | /// 模块设置功能DTO 14 | /// 15 | public class ModuleSetFunctionDto 16 | { 17 | /// 18 | /// 获取或设置 模块编号 19 | /// 20 | public int ModuleId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 功能编号集合 24 | /// 25 | public Guid[] FunctionIds { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Dtos/RoleSetModuleDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-08 13:10 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Authorization.Dtos; 11 | 12 | /// 13 | /// 角色设置权限DTO 14 | /// 15 | public class RoleSetModuleDto 16 | { 17 | /// 18 | /// 获取或设置 角色编号 19 | /// 20 | public int RoleId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 要设置的模块编号集合 24 | /// 25 | public int[] ModuleIds { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Dtos/UserSetModuleDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-08 12:21 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Authorization.Dtos; 11 | 12 | /// 13 | /// 用户设置模块DTO 14 | /// 15 | public class UserSetModuleDto 16 | { 17 | /// 18 | /// 获取或设置 用户编号 19 | /// 20 | public int UserId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 要设置的模块编号 24 | /// 25 | public int[] ModuleIds { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Dtos/UserSetRoleDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-08 12:21 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Authorization.Dtos; 11 | 12 | /// 13 | /// 用户设置角色DTO 14 | /// 15 | public class UserSetRoleDto 16 | { 17 | /// 18 | /// 获取或设置 用户编号 19 | /// 20 | public int UserId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 要设置的角色编号 24 | /// 25 | public int[] RoleIds { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Authorization/Entities/Module.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Authorization.Entities; 11 | 12 | /// 13 | /// 实体类:模块信息 14 | /// 15 | [Description("模块信息")] 16 | public class Module : ModuleBase 17 | { 18 | /// 19 | /// 获取或设置 父模块信息 20 | /// 21 | public virtual Module Parent { get; set; } 22 | 23 | /// 24 | /// 获取或设置 子模块信息集合 25 | /// 26 | public virtual ICollection Children { get; set; } = new List(); 27 | } 28 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Common/Dtos/ListNode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp.Hosting.Core/Common/Dtos/ListNode.cs -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Common/ICommonContract.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-03 12:59 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Common; 11 | 12 | /// 13 | /// 业务契约:通用业务 14 | /// 15 | public interface ICommonContract 16 | { 17 | /// 18 | /// 测试测试 19 | /// 20 | string Test(); 21 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Dtos/ConfirmEmailDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | 11 | namespace OSharp.Hosting.Identity.Dtos; 12 | 13 | /// 14 | /// 确认邮箱DTO 15 | /// 16 | public class ConfirmEmailDto 17 | { 18 | /// 19 | /// 获取或设置 用户编号 20 | /// 21 | [Required] 22 | public int UserId { get; set; } 23 | 24 | /// 25 | /// 获取或设置 邮件码 26 | /// 27 | [Required] 28 | public string Code { get; set; } 29 | } 30 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Dtos/RoleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Hosting.Identity.Entities; 11 | using OSharp.Identity.Dtos; 12 | 13 | 14 | namespace OSharp.Hosting.Identity.Dtos; 15 | 16 | /// 17 | /// 输入DTO:角色信息 18 | /// 19 | [MapTo(typeof(Role))] 20 | public class RoleInputDto : RoleInputDtoBase 21 | { } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Dtos/RoleNode.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Hosting.Identity.Entities; 11 | 12 | 13 | namespace OSharp.Hosting.Identity.Dtos; 14 | 15 | /// 16 | /// 角色节点 17 | /// 18 | [MapFrom(typeof(Role))] 19 | public class RoleNode 20 | { 21 | /// 22 | /// 获取或设置 角色编号 23 | /// 24 | public int RoleId { get; set; } 25 | 26 | /// 27 | /// 获取或设置 角色名称 28 | /// 29 | public string RoleName { get; set; } 30 | } 31 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Dtos/UserInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Hosting.Identity.Entities; 11 | using OSharp.Identity.Dtos; 12 | 13 | 14 | namespace OSharp.Hosting.Identity.Dtos; 15 | 16 | /// 17 | /// 输入DTO:用户信息 18 | /// 19 | [MapTo(typeof(User))] 20 | public class UserInputDto : UserInputDtoBase 21 | { } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Dtos/UserRoleInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Hosting.Identity.Entities; 11 | using OSharp.Identity.Dtos; 12 | 13 | 14 | namespace OSharp.Hosting.Identity.Dtos; 15 | 16 | /// 17 | /// 输入DTO:用户角色信息 18 | /// 19 | [MapTo(typeof(UserRole))] 20 | public class UserRoleInputDto : UserRoleInputDtoBase 21 | { } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Entities/RoleClaim.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | 11 | namespace OSharp.Hosting.Identity.Entities; 12 | 13 | /// 14 | /// 实体类:角色声明信息 15 | /// 16 | [Description("角色声明信息")] 17 | public class RoleClaim : RoleClaimBase 18 | { 19 | /// 20 | /// 获取或设置 所属角色信息 21 | /// 22 | public virtual Role Role { get; set; } 23 | } 24 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Entities/UserClaim.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Identity.Entities; 11 | 12 | /// 13 | /// 实体类:用户声明信息 14 | /// 15 | [Description("用户声明信息")] 16 | public class UserClaim : UserClaimBase 17 | { 18 | /// 19 | /// 获取或设置 所属用户 20 | /// 21 | public virtual User User { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Entities/UserLogin.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Identity.Entities; 11 | 12 | /// 13 | /// 实体类:用户登录及其提供程序 14 | /// 15 | [Description("用户登录及其提供程序")] 16 | public class UserLogin : UserLoginBase 17 | { 18 | /// 19 | /// 获取或设置 所属用户信息 20 | /// 21 | public virtual User User { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Entities/UserRole.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Identity.Entities; 11 | 12 | /// 13 | /// 实体类:用户角色信息 14 | /// 15 | [Description("用户角色信息")] 16 | public class UserRole : UserRoleBase 17 | { 18 | /// 19 | /// 获取或设置 关联用户信息 20 | /// 21 | public virtual User User { get; set; } 22 | 23 | /// 24 | /// 获取或设置 关联角色信息 25 | /// 26 | public virtual Role Role { get; set; } 27 | } 28 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Entities/UserToken.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Identity.Entities; 11 | 12 | /// 13 | /// 实体类:用户的身份认证令牌 14 | /// 15 | [Description("用户的身份认证令牌")] 16 | public class UserToken : UserTokenBase 17 | { 18 | /// 19 | /// 获取或设置 所属用户信息 20 | /// 21 | public virtual User User { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Identity/Events/LogoutEventData.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-27 4:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Identity.Events; 11 | 12 | /// 13 | /// 用户退出事件数据 14 | /// 15 | public class LogoutEventData : EventDataBase 16 | { 17 | /// 18 | /// 获取或设置 用户编号 19 | /// 20 | public int UserId { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Infos/Dtos/MessageInputDto.cs: -------------------------------------------------------------------------------- 1 | namespace OSharp.Hosting.Infos.Dtos; 2 | 3 | public partial class MessageInputDto 4 | { 5 | /// 6 | /// 获取或设置 公共消息的接收角色编号集合 7 | /// 8 | public ICollection PublicRoleIds { get; set; } 9 | 10 | /// 11 | /// 获取或设置 私人消息的接收者编号集合 12 | /// 13 | public ICollection RecipientIds { get; set; } 14 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Infos/Entities/Message.cs: -------------------------------------------------------------------------------- 1 | namespace OSharp.Hosting.Infos.Entities; 2 | 3 | [TableNamePrefix("Infos")] 4 | public partial class Message 5 | { 6 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Infos/Entities/MessageReceive.cs: -------------------------------------------------------------------------------- 1 | namespace OSharp.Hosting.Infos.Entities; 2 | 3 | [TableNamePrefix("Infos")] 4 | public partial class MessageReceive 5 | { 6 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Infos/Entities/MessageReply.cs: -------------------------------------------------------------------------------- 1 | namespace OSharp.Hosting.Infos.Entities; 2 | 3 | [TableNamePrefix("Infos")] 4 | public partial class MessageReply 5 | { 6 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Infos/Entities/MessageType.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-09-10 18:39 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Infos.Entities; 11 | 12 | /// 13 | /// 表示消息类型的枚举 14 | /// 15 | public enum MessageType 16 | { 17 | /// 18 | /// 系统消息,用于系统对全体人员的消息类型表示 19 | /// 20 | System = 0, 21 | 22 | /// 23 | /// 公共消息,用于系统对局部范围的人员的消息类型表示 24 | /// 25 | Public = 1, 26 | 27 | /// 28 | /// 私人消息,用于个人对个人的消息类型表示 29 | /// 30 | Private = 2 31 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Infos/Events/MessageCreatedEventData.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-15 9:27 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.Hosting.Infos.Entities; 11 | 12 | using OSharp.EventBuses; 13 | 14 | 15 | namespace OSharp.Hosting.Infos.Events; 16 | 17 | /// 18 | /// 事件数据:发送消息 19 | /// 20 | public class MessageCreatedEventData : EventDataBase 21 | { 22 | /// 23 | /// 获取或设置 新增的消息 24 | /// 25 | public Message[] Messages { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Systems/Dtos/GenerateCodeInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-06 22:37 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Systems.Dtos; 11 | 12 | /// 13 | /// 代码生成输入DTO 14 | /// 15 | public class GenerateCodeInputDto 16 | { } -------------------------------------------------------------------------------- /src/OSharp.Hosting.Core/Systems/Dtos/SystemSetting.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2022 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2022-11-11 2:58 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Hosting.Systems.Dtos; 11 | 12 | /// 13 | /// 系统设置项 14 | /// 15 | public class SystemSetting : ISetting 16 | { } 17 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.EntityConfiguration/OSharp.Hosting.EntityConfiguration.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.Hosting.EntityConfiguration 9 | OSharp框架非业务实体映射 10 | OSharp框架非业务实体映射,封装框架非业务如认证,权限,系统,消息等模块的EFCore实体映射 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/OSharp.Hosting.EntityConfiguration/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.EntityFrameworkCore; 2 | global using Microsoft.EntityFrameworkCore.Metadata.Builders; 3 | global using OSharp.Authorization.EntityInfos; 4 | global using OSharp.Entity; 5 | global using OSharp.Authorization.Functions; 6 | -------------------------------------------------------------------------------- /src/OSharp.Log4Net/Log4NetPack.cs: -------------------------------------------------------------------------------- 1 | namespace OSharp.Log4Net; 2 | 3 | /// 4 | /// Log4Net模块 5 | /// 6 | [Description("Log4Net日志模块")] 7 | public class Log4NetPack : OsharpPack 8 | { 9 | /// 10 | /// 获取 模块级别,级别越小越先启动 11 | /// 12 | public override PackLevel Level => PackLevel.Application; 13 | 14 | /// 15 | /// 获取 模块启动顺序,模块启动的顺序先按级别启动,级别内部再按此顺序启动, 16 | /// 级别默认为0,表示无依赖,需要在同级别有依赖顺序的时候,再重写为>0的顺序值 17 | /// 18 | public override int Order => 0; 19 | 20 | /// 21 | /// 将模块服务添加到依赖注入服务容器中 22 | /// 23 | /// 依赖注入服务容器 24 | /// 25 | public override IServiceCollection AddServices(IServiceCollection services) 26 | { 27 | services.AddSingleton(); 28 | return services; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/OSharp.Log4Net/OSharp.Log4Net.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.Log4Net 9 | OSharp Log4Net组件 10 | OSharp Log4Net组件,封装使用log4net组件来实现框架的日志输出功能 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/OSharp.Log4Net/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.Collections.Concurrent; 2 | global using System.ComponentModel; 3 | global using System.Reflection; 4 | 5 | global using Microsoft.Extensions.DependencyInjection; 6 | global using Microsoft.Extensions.Logging; 7 | 8 | global using OSharp.Core.Packs; 9 | global using OSharp.Data; 10 | -------------------------------------------------------------------------------- /src/OSharp.MiniProfiler/MiniProfilerPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-01-05 1:47 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.MiniProfiler; 11 | 12 | /// 13 | /// MiniProfiler模块 14 | /// 15 | [Description("MiniProfiler模块")] 16 | public class MiniProfilerPack : MiniProfilerPackBase 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp.MiniProfiler/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | 3 | global using Microsoft.AspNetCore.Builder; 4 | global using Microsoft.Extensions.DependencyInjection; 5 | 6 | global using OSharp.AspNetCore; 7 | global using OSharp.Core.Packs; 8 | -------------------------------------------------------------------------------- /src/OSharp.NLog/OSharp.NLog.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | net6.0;net7.0;net8.0;net9.0 8 | OSharp.NLog 9 | OSharp NLog组件,封装使用nlog组件来实现框架的日志输出功能 10 | OSharp NLog组件 11 | false 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/OSharp.NLog/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.Collections.Concurrent; 2 | global using System.ComponentModel; 3 | global using System.Reflection; 4 | global using System.Text; 5 | 6 | global using Microsoft.Extensions.DependencyInjection; 7 | global using Microsoft.Extensions.Logging; 8 | 9 | global using OSharp.Core.Packs; 10 | global using OSharp.Data; 11 | -------------------------------------------------------------------------------- /src/OSharp.NLog/nlog.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/OSharp.Redis/Readme.md: -------------------------------------------------------------------------------- 1 | # Redis 模块 2 | 3 | ## 单机用法 4 | 如果只是单台服务器使用Redis,可按照如下配置方式使用: 5 | 1. 通过nuget引用 `OSharp.Redis` 程序集 6 | > Install-Package OSharp.Redis 7 | 2. 在 `appsettings.json` 中添加如下配置节点 8 | ``` 9 | { 10 | "OSharp": { 11 | "Redis": { 12 | "Configuration": "localhost", 13 | "InstanceName": "OSharpDemo", 14 | "Enabled": "true" 15 | } 16 | } 17 | } 18 | ``` 19 | 3. 如果要禁用Redis缓存功能,设置上面的配置 `Enabled: false` 即可。当启用Redis时,会自动清除已有的`IDistributedCache`分布式缓存实现 20 | 21 | ## 集群用法 22 | 如果要使用多服务器使用Redis集群,可通过继承基类`RedisPackCore`重写,给`RedisCacheOptions.ConfigurationOptions`属性赋值即可。 23 | -------------------------------------------------------------------------------- /src/OSharp.Redis/RedisPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-12-14 20:14 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Redis; 11 | 12 | /// 13 | /// Redis模块 14 | /// 15 | [Description("Redis模块")] 16 | public class RedisPack : RedisPackBase 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp.Redis/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | 3 | global using Microsoft.Extensions.Caching.Distributed; 4 | global using Microsoft.Extensions.Configuration; 5 | global using Microsoft.Extensions.DependencyInjection; 6 | global using Microsoft.Extensions.DependencyInjection.Extensions; 7 | 8 | global using Newtonsoft.Json; 9 | 10 | global using OSharp.Core.Options; 11 | global using OSharp.Core.Packs; 12 | global using OSharp.Exceptions; 13 | global using OSharp.Extensions; 14 | -------------------------------------------------------------------------------- /src/OSharp.Swagger/HiddenApiAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-03-31 13:32 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Swagger; 11 | 12 | /// 13 | /// 标记此过滤器,API将在Swagger界面中隐藏 14 | /// 15 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 16 | public sealed class HiddenApiAttribute : Attribute 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp.Swagger/Readme.md: -------------------------------------------------------------------------------- 1 | # Swagger 模块 2 | 3 | ## 用法 4 | 可按照如下配置方式使用: 5 | 1. 通过nuget引用 `OSharp.Swagger` 程序集 6 | > Install-Package OSharp.Swagger 7 | 2. 在 `appsettings.json` 中添加如下配置节点 8 | ``` 9 | "Swagger": { 10 | "Endpoints": [ 11 | { 12 | "Title": "框架API", 13 | "Version": "v1", 14 | "Url": "/swagger/v1/swagger.json" 15 | }, 16 | { 17 | "Title": "业务API", 18 | "Version": "buss", 19 | "Url": "/swagger/buss/swagger.json" 20 | } 21 | ], 22 | "RoutePrefix": "swagger", 23 | "IsHideSchemas": false, 24 | "MiniProfiler": true, 25 | "Enabled": true 26 | } 27 | ``` 28 | 3. 要禁用Swagger,可以设置`Enabled: false` 29 | -------------------------------------------------------------------------------- /src/OSharp.Swagger/SwaggerPack.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-04-15 16:35 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Swagger; 11 | 12 | /// 13 | /// SwaggerApi模块 14 | /// 15 | [Description("SwaggerApi模块 ")] 16 | public class SwaggerPack : SwaggerPackBase 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp.Swagger/_GlobalUsing.cs: -------------------------------------------------------------------------------- 1 | global using System.ComponentModel; 2 | global using System.Reflection; 3 | 4 | global using Microsoft.AspNetCore.Builder; 5 | global using Microsoft.AspNetCore.Mvc; 6 | global using Microsoft.AspNetCore.Mvc.ApiExplorer; 7 | global using Microsoft.Extensions.Configuration; 8 | global using Microsoft.Extensions.DependencyInjection; 9 | global using Microsoft.OpenApi.Models; 10 | 11 | global using OSharp.AspNetCore; 12 | global using OSharp.Core.Options; 13 | global using OSharp.Core.Packs; 14 | global using OSharp.Reflection; 15 | -------------------------------------------------------------------------------- /src/OSharp.Utils/Caching/ICacheKeyGenerator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2016 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2016-11-16 23:41 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Caching 11 | { 12 | /// 13 | /// 定义缓存键生成功能 14 | /// 15 | public interface ICacheKeyGenerator 16 | { 17 | /// 18 | /// 生成缓存键 19 | /// 20 | /// 参数 21 | /// 22 | string GetKey(params object[] args); 23 | } 24 | } -------------------------------------------------------------------------------- /src/OSharp.Utils/Data/Snows/Contract/IIdGenerator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 版权属于:yitter(yitter@126.com) 3 | * 开源地址:https://gitee.com/yitter/idgenerator 4 | * 版权协议:MIT 5 | * 版权说明:只要保留本版权,你可以免费使用、修改、分发本代码。 6 | * 免责条款:任何因为本代码产生的系统、法律、政治、宗教问题,均与版权所有者无关。 7 | * 8 | */ 9 | 10 | using System; 11 | 12 | namespace OSharp.Data.Snows 13 | { 14 | public interface IIdGenerator 15 | { 16 | /// 17 | /// 生成过程中产生的事件 18 | /// 19 | Action GenIdActionAsync { get; set; } 20 | 21 | /// 22 | /// 生成新的long型Id 23 | /// 24 | /// 25 | long NewLong(); 26 | 27 | // Guid NewGuid(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/OSharp.Utils/Data/Snows/Contract/ISnowWorker.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 版权属于:yitter(yitter@126.com) 3 | * 开源地址:https://gitee.com/yitter/idgenerator 4 | * 版权协议:MIT 5 | * 版权说明:只要保留本版权,你可以免费使用、修改、分发本代码。 6 | * 免责条款:任何因为本代码产生的系统、法律、政治、宗教问题,均与版权所有者无关。 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace OSharp.Data.Snows 15 | { 16 | internal interface ISnowWorker 17 | { 18 | Action GenAction { get; set; } 19 | 20 | long NextId(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/OSharp.Utils/Drawing/ValidateCodeType.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-28 22:29 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Drawing 11 | { 12 | /// 13 | /// 验证码类型 14 | /// 15 | public enum ValidateCodeType 16 | { 17 | /// 18 | /// 纯数值 19 | /// 20 | Number, 21 | 22 | /// 23 | /// 数值与字母的组合 24 | /// 25 | NumberAndLetter, 26 | 27 | /// 28 | /// 汉字 29 | /// 30 | Hanzi 31 | } 32 | } -------------------------------------------------------------------------------- /src/OSharp.Utils/Maths/MathHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | 4 | namespace OSharp.Maths 5 | { 6 | /// 7 | /// 数据计算辅助操作类 8 | /// 9 | public static class MathHelper 10 | { 11 | /// 12 | /// 获取两个坐标的距离 13 | /// 14 | public static double GetDistance(double x1, double y1, double x2, double y2) 15 | { 16 | return Math.Sqrt(Math.Pow((x1 - x2), 2) + Math.Pow((y1 - y2), 2)); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/OSharp.Utils/Net/IpLocation.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp.Utils/Net/IpLocation.cs -------------------------------------------------------------------------------- /src/OSharp.Utils/Threading/ICancellationTokenProvider.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-04-09 22:54 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.Threading; 11 | 12 | 13 | namespace OSharp.Threading 14 | { 15 | /// 16 | /// 定义异步任务取消标识提供器 17 | /// 18 | public interface ICancellationTokenProvider 19 | { 20 | /// 21 | /// 获取 异步任务取消标识 22 | /// 23 | CancellationToken Token { get; } 24 | } 25 | } -------------------------------------------------------------------------------- /src/OSharp.Utils/Threading/NoneCancellationTokenProvider.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-04-09 22:53 8 | // ----------------------------------------------------------------------- 9 | 10 | using System.Threading; 11 | 12 | 13 | namespace OSharp.Threading 14 | { 15 | /// 16 | /// 默认的异步任务取消标识提供者空实现 17 | /// 18 | public class NoneCancellationTokenProvider : ICancellationTokenProvider 19 | { 20 | /// 21 | /// 获取 异步任务取消标识 22 | /// 23 | public CancellationToken Token { get; } = CancellationToken.None; 24 | } 25 | } -------------------------------------------------------------------------------- /src/OSharp.Wpf/Data/WpfConstants.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-28 19:27 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Wpf.Data; 11 | 12 | /// 13 | /// 常量 14 | /// 15 | public static class WpfConstants 16 | { 17 | /// 18 | /// 浏览器客户端组名称 19 | /// 20 | public const string GroupNameBrowser = "BrowserClientGroup"; 21 | 22 | /// 23 | /// WPF客户端组名称 24 | /// 25 | public const string GroupNameWpf = "WpfClientGroup"; 26 | } -------------------------------------------------------------------------------- /src/OSharp.Wpf/Hubs/Reflection/MethodCallInfo.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-29 19:56 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Wpf.Hubs.Reflection; 11 | 12 | /// 13 | /// 方法调用信息 14 | /// 15 | public class MethodCallInfo 16 | { 17 | /// 反射法名称 18 | public string MethodName { get; set; } 19 | 20 | /// 参数值 21 | public Type[] ParameterTypes { get; set; } 22 | } 23 | -------------------------------------------------------------------------------- /src/OSharp.Wpf/Stylet/SingletonAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-05-28 15:00 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Wpf.Stylet; 11 | 12 | /// 13 | /// 标注Stylet的单例视图模型 14 | /// 15 | [AttributeUsage(AttributeTargets.Class)] 16 | public class SingletonAttribute : Attribute 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp/Audits/AuditIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-03-26 15:06 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Audits; 11 | 12 | /// 13 | /// 标记在审计中忽略的属性 14 | /// 15 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] 16 | public sealed class AuditIgnoreAttribute : Attribute 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp/Audits/OperateType.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-08-02 3:59 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Audits; 11 | 12 | /// 13 | /// 表示实体审计操作类型 14 | /// 15 | public enum OperateType 16 | { 17 | /// 18 | /// 查询 19 | /// 20 | Query = 0, 21 | /// 22 | /// 新增 23 | /// 24 | Insert = 1, 25 | /// 26 | /// 更新 27 | /// 28 | Update = 2, 29 | /// 30 | /// 删除 31 | /// 32 | Delete = 3 33 | } -------------------------------------------------------------------------------- /src/OSharp/Authorization/DataAuthOperation.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-14 11:18 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization; 11 | 12 | /// 13 | /// 数据权限操作 14 | /// 15 | public enum DataAuthOperation 16 | { 17 | /// 18 | /// 读取 19 | /// 20 | [Description("读取")] 21 | Read, 22 | 23 | /// 24 | /// 更新 25 | /// 26 | [Description("更新")] 27 | Update, 28 | 29 | /// 30 | /// 删除 31 | /// 32 | [Description("删除")] 33 | Delete 34 | } -------------------------------------------------------------------------------- /src/OSharp/Authorization/EntityInfos/EntityInfo.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-10 20:14 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.EntityInfos; 11 | 12 | /// 13 | /// 实体类:实体信息类 14 | /// 15 | [Description("实体信息类")] 16 | [TableNamePrefix("Auth")] 17 | public class EntityInfo : EntityInfoBase 18 | { } -------------------------------------------------------------------------------- /src/OSharp/Authorization/EntityInfos/EntityInfoHandler.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-10 20:14 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.EntityInfos; 11 | 12 | /// 13 | /// 实体信息处理器 14 | /// 15 | public class EntityInfoHandler : EntityInfoHandlerBase 16 | { 17 | /// 18 | /// 初始化一个类型的新实例 19 | /// 20 | public EntityInfoHandler(IServiceProvider serviceProvider) 21 | : base(serviceProvider) 22 | { } 23 | } -------------------------------------------------------------------------------- /src/OSharp/Authorization/FunctionAuthorization.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-05-11 1:05 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization; 11 | 12 | /// 13 | /// 功能权限验证类 14 | /// 15 | public class FunctionAuthorization : FunctionAuthorizationBase 16 | { 17 | /// 18 | /// 初始化一个类型的新实例 19 | /// 20 | public FunctionAuthorization(IFunctionAuthCache functionAuthCache) 21 | : base(functionAuthCache) 22 | { } 23 | } -------------------------------------------------------------------------------- /src/OSharp/Authorization/Functions/Function.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-10 20:13 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.Functions; 11 | 12 | /// 13 | /// 实体类:功能信息 14 | /// 15 | [Description("功能信息")] 16 | [TableNamePrefix("Auth")] 17 | public class Function : FunctionBase 18 | { } -------------------------------------------------------------------------------- /src/OSharp/Authorization/Functions/NonFunctionAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-10 20:14 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.Functions; 11 | 12 | /// 13 | /// 标注当前Action不作为Function信息进行收集 14 | /// 15 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 16 | public class NonFunctionAttribute : Attribute 17 | { } -------------------------------------------------------------------------------- /src/OSharp/Authorization/LoggedInAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 7 | // 2017-09-15 2:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization; 11 | 12 | /// 13 | /// 指定功能需要登录才能访问 14 | /// 15 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 16 | public class LoggedInAttribute : Attribute 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp/Authorization/Modules/IModuleHandler.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-10 20:13 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.Modules; 11 | 12 | /// 13 | /// 定义模块信息处理器,负责在系统初始化时从程序集获取最新的模块信息,并同步到数据库中 14 | /// 15 | public interface IModuleHandler 16 | { 17 | /// 18 | /// 获取 所有模块信息 19 | /// 20 | ModuleInfo[] ModuleInfos { get; } 21 | 22 | /// 23 | /// 从程序集中获取模块信息 24 | /// 25 | void Initialize(); 26 | } -------------------------------------------------------------------------------- /src/OSharp/Authorization/Modules/IModuleInfoPicker.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-02-10 20:13 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization.Modules; 11 | 12 | /// 13 | /// 定义模块信息提取器,从程序集中提取模块信息 14 | /// 15 | public interface IModuleInfoPicker 16 | { 17 | /// 18 | /// 从程序集收集模块信息 19 | /// 20 | /// 21 | ModuleInfo[] Pickup(); 22 | } -------------------------------------------------------------------------------- /src/OSharp/Authorization/RoleLimitAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 7 | // 2017-09-15 2:45 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Authorization; 11 | 12 | /// 13 | /// 指定功能只允许特定角色可以访问 14 | /// 15 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] 16 | public class RoleLimitAttribute : Attribute 17 | { } 18 | -------------------------------------------------------------------------------- /src/OSharp/CodeGenerator/IgnoreGenPropertyAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-08-06 13:08 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.CodeGenerator; 11 | 12 | /// 13 | /// 标记要在CodeGenerator生成代码时忽略的属性 14 | /// 15 | public class IgnoreGenPropertyAttribute : Attribute 16 | { } -------------------------------------------------------------------------------- /src/OSharp/CodeGenerator/IgnoreGenTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-08-06 13:07 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.CodeGenerator; 11 | 12 | /// 13 | /// 标记要在CodeGenerator生成代码时忽略的类型 14 | /// 15 | public class IgnoreGenTypeAttribute : Attribute 16 | { } -------------------------------------------------------------------------------- /src/OSharp/Core/Options/MvcOptions.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-04-20 15:15 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Core.Options; 11 | 12 | /// 13 | /// Mvc选项 14 | /// 15 | public class MvcOptions 16 | { 17 | /// 18 | /// 获取或设置 Json属性小写,默认:true 19 | /// 20 | public bool IsLowercaseJsonProperty { get; set; } = true; 21 | 22 | /// 23 | /// 获取或设置 是否URL小写,默认:false 24 | /// 25 | public bool IsLowercaseUrls { get; set; } = false; 26 | } 27 | -------------------------------------------------------------------------------- /src/OSharp/Core/Options/RedisOptions.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-12-14 17:00 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Core.Options; 11 | 12 | /// 13 | /// Redis选项 14 | /// 15 | public class RedisOptions 16 | { 17 | /// 18 | /// 获取或设置 Redis连接配置 19 | /// 20 | public string Configuration { get; set; } 21 | 22 | /// 23 | /// 获取或设置 Redis实例名称 24 | /// 25 | public string InstanceName { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp/Core/Systems/ISetting.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp/Core/Systems/ISetting.cs -------------------------------------------------------------------------------- /src/OSharp/Core/Systems/SettingInputDto.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-08-24 17:21 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Core.Systems; 11 | 12 | /// 13 | /// 设置信息输入DTO 14 | /// 15 | public class SettingInputDto 16 | { 17 | /// 18 | /// 获取或设置 设置类型全名 19 | /// 20 | [Required] 21 | public string SettingTypeName { get; set; } 22 | 23 | /// 24 | /// 获取或设置 设置模型JSON 25 | /// 26 | public string SettingJson { get; set; } 27 | } -------------------------------------------------------------------------------- /src/OSharp/Core/Systems/SystemSettingKeys.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-06-25 21:26 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Core.Systems; 11 | 12 | /// 13 | /// 系统设置项键值 14 | /// 15 | public class SystemSettingKeys 16 | { 17 | public const string SiteName = "Site.Name"; 18 | public const string SiteDescription = "Site.Description"; 19 | } -------------------------------------------------------------------------------- /src/OSharp/Dependency/IHybridServiceScopeFactory.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-12-20 23:19 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// 工厂包装一下 14 | /// 15 | public interface IHybridServiceScopeFactory 16 | { 17 | /// 18 | /// 创建依赖注入服务的作用域,如果当前操作处于HttpRequest作用域中,直接使用HttpRequest的作用域,否则创建新的作用域 19 | /// 20 | /// 21 | IServiceScope CreateScope(); 22 | } -------------------------------------------------------------------------------- /src/OSharp/Dependency/IScopeDependency.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-16 22:34 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// 实现此接口的类型将被注册为模式 14 | /// 15 | [IgnoreDependency] 16 | public interface IScopeDependency 17 | { } -------------------------------------------------------------------------------- /src/OSharp/Dependency/ISingletonDependency.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-16 22:36 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// 实现此接口的类型将被注册为模式 14 | /// 15 | [IgnoreDependency] 16 | public interface ISingletonDependency 17 | { } -------------------------------------------------------------------------------- /src/OSharp/Dependency/ITransientDependency.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-16 22:36 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// 实现此接口的类型将自动注册为模式 14 | /// 15 | [IgnoreDependency] 16 | public interface ITransientDependency 17 | { } -------------------------------------------------------------------------------- /src/OSharp/Dependency/IgnoreDependencyAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2022 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2022-11-11 0:20 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// 标注了此特性的类,将忽略依赖注入自动映射 14 | /// 15 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)] 16 | public class IgnoreDependencyAttribute : Attribute 17 | { } -------------------------------------------------------------------------------- /src/OSharp/Dependency/Lazier.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-08-04 23:57 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// Lazy延迟加载解析器 14 | /// 15 | internal class Lazier : Lazy where T : class 16 | { 17 | /// 18 | /// 初始化一个类型的新实例 19 | /// 20 | public Lazier(IServiceProvider provider) 21 | : base(provider.GetRequiredService) 22 | { } 23 | } -------------------------------------------------------------------------------- /src/OSharp/Dependency/MultipleDependencyAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-04 0:34 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Dependency; 11 | 12 | /// 13 | /// 标记允许多重注入,即一个接口可以注入多个实例 14 | /// 15 | [AttributeUsage(AttributeTargets.Interface)] 16 | public class MultipleDependencyAttribute : Attribute 17 | { } -------------------------------------------------------------------------------- /src/OSharp/Entity/IConnectionStringProvider.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-03-20 21:30 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 数据库连接字符串提供器 14 | /// 15 | public interface IConnectionStringProvider 16 | { 17 | /// 18 | /// 获取指定数据上下文类型的数据库连接字符串 19 | /// 20 | /// 数据上下文类型 21 | /// 22 | string GetConnectionString(Type dbContextType); 23 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/ICreatedTime.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-18 14:11 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义创建时间 14 | /// 15 | public interface ICreatedTime 16 | { 17 | /// 18 | /// 获取或设置 创建时间 19 | /// 20 | [DisplayName("创建时间")] 21 | DateTime CreatedTime { get; set; } 22 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/ICreationAudited.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-04-12 10:25 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义创建审计信息 14 | /// 15 | public interface ICreationAudited : ICreatedTime 16 | where TUserKey : struct 17 | { 18 | /// 19 | /// 获取或设置 创建者编号 20 | /// 21 | TUserKey? CreatorId { get; set; } 22 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/IEntity.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-16 22:37 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 数据模型接口 14 | /// 15 | public interface IEntity 16 | { 17 | /// 18 | /// 获取或设置 实体唯一标识,主键 19 | /// 20 | TKey Id { get; set; } 21 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/IEntityHash.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/src/OSharp/Entity/IEntityHash.cs -------------------------------------------------------------------------------- /src/OSharp/Entity/IExpirable.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-19 2:33 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义可过期性,包含生效时间和过期时间 14 | /// 15 | public interface IExpirable 16 | { 17 | /// 18 | /// 获取或设置 生效时间 19 | /// 20 | DateTime? BeginTime { get; set; } 21 | 22 | /// 23 | /// 获取或设置 过期时间 24 | /// 25 | DateTime? EndTime { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/ILockable.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-19 2:31 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义可锁定功能 14 | /// 15 | public interface ILockable 16 | { 17 | /// 18 | /// 获取或设置 是否锁定当前信息 19 | /// 20 | bool IsLocked { get; set; } 21 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/IMasterSlaveSplitPolicy.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-03-21 12:34 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义数据库主从分离策略 14 | /// 15 | public interface IMasterSlaveSplitPolicy 16 | { 17 | /// 18 | /// 是否前往从数据库 19 | /// 20 | /// 数据上下文选项 21 | /// 22 | bool IsToSlaveDatabase(OsharpDbContextOptions options); 23 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/ISeedDataInitializer.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2020 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2020-03-06 21:36 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义种子数据初始化 14 | /// 15 | [MultipleDependency] 16 | public interface ISeedDataInitializer 17 | { 18 | /// 19 | /// 获取 种子数据初始化的顺序 20 | /// 21 | int Order { get; } 22 | 23 | /// 24 | /// 获取 所属实体类型 25 | /// 26 | Type EntityType { get; } 27 | 28 | /// 29 | /// 初始化种子数据 30 | /// 31 | void Initialize(); 32 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/ISoftDeletable.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-02-14 22:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义逻辑删除功能 14 | /// 15 | public interface ISoftDeletable 16 | { 17 | /// 18 | /// 获取或设置 数据逻辑删除时间,为null表示正常数据,有值表示已逻辑删除,同时删除时间每次不同也能保证索引唯一性 19 | /// 20 | [DisplayName("删除时间")] 21 | DateTime? DeletedTime { get; set; } 22 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/IUpdateAudited.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-04-12 10:27 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 定义更新审计的信息 14 | /// 15 | public interface IUpdateAudited where TUserKey : struct 16 | { 17 | /// 18 | /// 获取或设置 更新者编号 19 | /// 20 | TUserKey? LastUpdaterId { get; set; } 21 | 22 | /// 23 | /// 获取或设置 最后更新时间 24 | /// 25 | DateTime? LastUpdatedTime { get; set; } 26 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/KeyGenerate/AutoIncreaseKeyGenerator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-03-14 13:37 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity.KeyGenerate; 11 | 12 | /// 13 | /// 自增长int主键生成器 14 | /// 15 | public class AutoIncreaseKeyGenerator : IKeyGenerator 16 | { 17 | /// 18 | /// 获取一个类型的主键数据 19 | /// 20 | /// 21 | public int Create() 22 | { 23 | return 0; 24 | } 25 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/KeyGenerate/IKeyGenerator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-03-14 13:35 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity.KeyGenerate; 11 | 12 | /// 13 | /// 定义TKey类型主键生成器 14 | /// 15 | public interface IKeyGenerator where TKey : IEquatable 16 | { 17 | /// 18 | /// 获取一个TKey类型的主键数据 19 | /// 20 | /// 21 | TKey Create(); 22 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/KeyGenerate/ISequentialGuidGenerator.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2021 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2021-03-14 13:48 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity.KeyGenerate; 11 | 12 | /// 13 | /// 定义有顺序的Guid主键生成器 14 | /// 15 | public interface ISequentialGuidGenerator : IKeyGenerator 16 | { 17 | /// 18 | /// 获取 顺序Guid数据库类型 19 | /// 20 | DatabaseType DatabaseType { get; } 21 | } -------------------------------------------------------------------------------- /src/OSharp/Entity/UserFlagAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-07-20 0:17 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Entity; 11 | 12 | /// 13 | /// 用户标记,用于标示用户属性/字段 14 | /// 15 | [AttributeUsage(AttributeTargets.Property)] 16 | public class UserFlagAttribute : Attribute 17 | { 18 | /// 19 | /// 当前用户标识 20 | /// 21 | public const string Token = "@CurrentUserId"; 22 | } -------------------------------------------------------------------------------- /src/OSharp/EventBuses/IEventBus.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-01-12 14:12 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.EventBuses; 11 | 12 | /// 13 | /// 定义线程总线 14 | /// 15 | public interface IEventBus : IEventSubscriber, IEventPublisher 16 | { 17 | 18 | } -------------------------------------------------------------------------------- /src/OSharp/EventBuses/IEventBusBuilder.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-09-19 1:54 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.EventBuses; 11 | 12 | /// 13 | /// 定义事件总线构建器 14 | /// 15 | public interface IEventBusBuilder 16 | { 17 | /// 18 | /// 构建事件总线 19 | /// 20 | void Build(); 21 | } -------------------------------------------------------------------------------- /src/OSharp/EventBuses/IEventData.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-01-12 11:43 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.EventBuses; 11 | 12 | /// 13 | /// 定义事件数据,所有事件都要实现该接口 14 | /// 15 | public interface IEventData 16 | { 17 | /// 18 | /// 获取 事件编号 19 | /// 20 | Guid Id { get; } 21 | 22 | /// 23 | /// 获取 事件发生的时间 24 | /// 25 | DateTime EventTime { get; } 26 | 27 | /// 28 | /// 获取或设置 事件源,触发事件的对象 29 | /// 30 | object EventSource { get; set; } 31 | } -------------------------------------------------------------------------------- /src/OSharp/EventBuses/IEventHandlerFactory.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-09-19 1:27 8 | // ----------------------------------------------------------------------- 9 | 10 | using OSharp.EventBuses.Internal; 11 | 12 | 13 | namespace OSharp.EventBuses; 14 | 15 | /// 16 | /// 定义获取实例的方式 17 | /// 18 | public interface IEventHandlerFactory 19 | { 20 | /// 21 | /// 获取事件处理器实例 22 | /// 23 | /// 24 | EventHandlerDisposeWrapper GetHandler(); 25 | } -------------------------------------------------------------------------------- /src/OSharp/EventBuses/Internal/PassThroughEventBus.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2018 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2018-01-12 15:31 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.EventBuses.Internal; 11 | 12 | /// 13 | /// 一个事件总线,当有消息被派发到消息总线时,消息总线将不做任何处理与路由,而是直接将消息推送到订阅方 14 | /// 15 | internal class PassThroughEventBus : EventBusBase 16 | { 17 | /// 18 | /// 初始化一个类型的新实例 19 | /// 20 | public PassThroughEventBus(IServiceProvider serviceProvider) 21 | : base(serviceProvider) 22 | { } 23 | } -------------------------------------------------------------------------------- /src/OSharp/Filter/CheckExistsType.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-15 23:33 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Filter; 11 | 12 | /// 13 | /// 指定可用于表数据存在性检查类型的值 14 | /// 15 | public enum CheckExistsType 16 | { 17 | /// 18 | /// 插入数据时重复性检查 19 | /// 20 | Insert, 21 | 22 | /// 23 | /// 编辑数据时重复性检查 24 | /// 25 | Update 26 | } -------------------------------------------------------------------------------- /src/OSharp/Filter/OperateCodeAttribute.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 OSharp. All rights reserved. 4 | // 5 | // 郭明锋 6 | // 2014:07:04 18:08 7 | // ----------------------------------------------------------------------- 8 | 9 | namespace OSharp.Filter; 10 | 11 | /// 12 | /// 表示查询操作的前台操作码 13 | /// 14 | public class OperateCodeAttribute : Attribute 15 | { 16 | /// 17 | /// 初始化一个类型的新实例 18 | /// 19 | public OperateCodeAttribute(string code) 20 | { 21 | Code = code; 22 | } 23 | 24 | /// 25 | /// 获取 属性名称 26 | /// 27 | public string Code { get; private set; } 28 | } -------------------------------------------------------------------------------- /src/OSharp/Http/HttpHeaderNames.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-31 1:27 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Http; 11 | 12 | public class HttpHeaderNames 13 | { 14 | public const string ClientPublicKey = "ClientPublicKey"; 15 | } -------------------------------------------------------------------------------- /src/OSharp/Identity/RequestClientType.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-11-09 15:12 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Identity; 11 | 12 | /// 13 | /// 请求的客户端类型 14 | /// 15 | public enum RequestClientType 16 | { 17 | /// 18 | /// 浏览器类型 19 | /// 20 | Browser, 21 | 22 | /// 23 | /// 桌面客户端 24 | /// 25 | Desktop, 26 | 27 | /// 28 | /// 手机客户端 29 | /// 30 | Mobile 31 | } -------------------------------------------------------------------------------- /src/OSharp/Mapping/IMapTuple.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2019 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2019-10-05 19:44 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Mapping; 11 | 12 | /// 13 | /// 定义对象映射源与目标配对 14 | /// 15 | [MultipleDependency] 16 | public interface IMapTuple 17 | { 18 | /// 19 | /// 获取 排序 20 | /// 21 | int Order { get; } 22 | 23 | /// 24 | /// 执行对象映射构造 25 | /// 26 | void CreateMap(); 27 | } -------------------------------------------------------------------------------- /src/OSharp/Net/IEmailSender.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2022 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2022-11-11 0:30 8 | // ----------------------------------------------------------------------- 9 | 10 | namespace OSharp.Net; 11 | 12 | /// 13 | /// 定义Email发送功能 14 | /// 15 | public interface IEmailSender 16 | { 17 | /// 18 | /// 发送Email 19 | /// 20 | /// 接收人Email 21 | /// Email标题 22 | /// Email内容 23 | /// 24 | Task SendEmailAsync(string email, string subject, string message); 25 | } -------------------------------------------------------------------------------- /src/OSharp/Reflection/IAssemblyFinder.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014-2017 OSharp. All rights reserved. 4 | // 5 | // http://www.osharp.org 6 | // 郭明锋 7 | // 2017-08-15 23:25 8 | // ----------------------------------------------------------------------- 9 | 10 | 11 | namespace OSharp.Reflection; 12 | 13 | /// 14 | /// 定义程序集查找器 15 | /// 16 | [IgnoreDependency] 17 | public interface IAssemblyFinder : IFinder 18 | { } -------------------------------------------------------------------------------- /tests/Liuliu.Demo.Core.Tests/CoreTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | using AsmResolver.DotNet; 9 | 10 | using Xunit; 11 | 12 | 13 | namespace Liuliu.Demo.Core.Tests 14 | { 15 | public class CoreTest 16 | { 17 | [Fact] 18 | public void Test01() 19 | { 20 | string path = "Liuliu.Demo.Core.dll"; 21 | var moduleDef = ModuleDefinition.FromFile(path); 22 | foreach (TypeDefinition typeDef in moduleDef.GetAllTypes()) 23 | { 24 | 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Liuliu.Demo.Core.Tests/Liuliu.Demo.Core.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/OSharp.AspNetCore.Tests/OSharp.AspNetCore.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Always 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/OSharp.AutoMapper.Tests/AutoMapperTests.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/tests/OSharp.AutoMapper.Tests/AutoMapperTests.cs -------------------------------------------------------------------------------- /tests/OSharp.AutoMapper.Tests/OSharp.AutoMapper.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Always 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tests/OSharp.AutoMapper.Tests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "OSharp": { 3 | 4 | } 5 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Audits/AuditEntityEventDataTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | using OSharp.Audits; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | 8 | using Shouldly; 9 | 10 | 11 | namespace OSharp.Audits.Tests 12 | { 13 | public class AuditEntityEventDataTests 14 | { 15 | [Fact()] 16 | public void AuditEntityEventDataTest() 17 | { 18 | var list = new List() { new AuditEntityEntry() }; 19 | AuditEntityEventData eventData = new AuditEntityEventData(list); 20 | eventData.AuditEntities.ShouldNotBeNull(); 21 | eventData.AuditEntities.ShouldNotBeEmpty(); 22 | eventData.AuditEntities.First().ShouldBe(list[0]); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Audits/AuditOperationEntryTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | using OSharp.Audits; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | using Shouldly; 8 | 9 | 10 | namespace OSharp.Audits.Tests 11 | { 12 | public class AuditOperationEntryTests 13 | { 14 | [Fact()] 15 | public void AuditOperationEntryTest() 16 | { 17 | AuditOperationEntry operation = new AuditOperationEntry(); 18 | operation.EntityEntries.ShouldNotBeNull(); 19 | operation.EntityEntries.ShouldBeEmpty(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Authorization/DataAuthServiceTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Extensions.DependencyInjection; 2 | 3 | 4 | namespace OSharp.Authorization.Tests 5 | { 6 | public class DataAuthServiceTests 7 | { 8 | public DataAuthServiceTests() 9 | { 10 | IServiceCollection services = new ServiceCollection(); 11 | 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Caching/ArrayExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using OSharp.Collections; 2 | 3 | using Shouldly; 4 | 5 | using Xunit; 6 | 7 | 8 | namespace OSharp.Caching.Tests 9 | { 10 | public class ArrayExtensionsTests 11 | { 12 | [Fact] 13 | public void CopyTest() 14 | { 15 | byte[,] bytes = new byte[2, 3] { { 10, 11, 12 }, { 13, 14, 15 } }; 16 | byte[,] newBytes = bytes.Copy(); 17 | newBytes[0, 1].ShouldBe(bytes[0, 1]); 18 | newBytes.ShouldBe(bytes); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Caching/StringCacheKeyGeneratorTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Shouldly; 4 | 5 | using Xunit; 6 | 7 | 8 | namespace OSharp.Caching.Tests 9 | { 10 | public class StringCacheKeyGeneratorTests 11 | { 12 | [Fact] 13 | public void GetKeyTest() 14 | { 15 | ICacheKeyGenerator generator = new StringCacheKeyGenerator(); 16 | Assert.Throws(() => 17 | { 18 | generator.GetKey(); 19 | }); 20 | 21 | Assert.Throws(() => 22 | { 23 | generator.GetKey(new object[0]); 24 | }); 25 | 26 | generator.GetKey("abc", 123, false).ShouldBe("abc-123-False"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/CommandLine/test.bat: -------------------------------------------------------------------------------- 1 | dotnet --info -------------------------------------------------------------------------------- /tests/OSharp.Tests/Data/CombGuidTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Shouldly; 6 | 7 | using Xunit; 8 | 9 | 10 | namespace OSharp.Data.Tests 11 | { 12 | public class CombGuidTests 13 | { 14 | [Fact] 15 | public void NewGuid_Test() 16 | { 17 | List ids = new List(); 18 | for (int i = 0; i < 100; i++) 19 | { 20 | ids.Add(CombGuid.NewGuid()); 21 | } 22 | ids.Distinct().Count().ShouldBe(100); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Data/CompressionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using OSharp.Extensions; 4 | 5 | using Xunit; 6 | 7 | namespace OSharp.Data.Tests 8 | { 9 | public class CompressionTests 10 | { 11 | [Fact()] 12 | public void CompressTest() 13 | { 14 | string value = "admin"; 15 | 16 | string temp = Compression.Compress(value); 17 | string result = Compression.Decompress(temp); 18 | Assert.Equal(value, result); 19 | 20 | Random rnd = new Random(); 21 | byte[] sourceBytes = rnd.NextBytes(10000); 22 | byte[] tempBytes = Compression.Compress(sourceBytes); 23 | byte[] resultBytes = Compression.Decompress(tempBytes); 24 | Assert.Equal(sourceBytes, resultBytes); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Data/PinYinConverterTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace OSharp.Data.Tests 4 | { 5 | public class PinYinConverterTests 6 | { 7 | [Fact()] 8 | public void GetFirstTest() 9 | { 10 | string input = "把汉字转换成拼音"; 11 | string actual = "BHZZHCPY"; 12 | Assert.Equal(PinYinConverter.GetFirst(input), actual); 13 | input = "把汉字转换成拼音"; 14 | actual = "BaHanZiZhuanHuanChengPinYin"; 15 | Assert.Equal(PinYinConverter.Get(input), actual); 16 | input = "把汉字,转换,成<拼音>"; 17 | actual = "BaHanZi,ZhuanHuan,Cheng"; 18 | Assert.Equal(PinYinConverter.Get(input), actual); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Dependency/ServiceCollectionTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Microsoft.Extensions.DependencyInjection; 4 | 5 | using Xunit; 6 | 7 | 8 | namespace OSharp.Tests.Dependency 9 | { 10 | public class ServiceCollectionTests 11 | { 12 | [Fact] 13 | public void AddTest() 14 | { 15 | IServiceCollection services = new ServiceCollection(); 16 | 17 | services.AddTransient(); 18 | 19 | IServiceProvider provider = services.BuildServiceProvider(); 20 | ITestContract contract = provider.GetService(); 21 | Assert.NotNull(contract); 22 | 23 | } 24 | 25 | private interface ITestContract { } 26 | 27 | private class TestService1 : ITestContract { } 28 | 29 | private class TestService2 : ITestContract { } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Develop/CodeRamerTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Shouldly; 4 | 5 | using Xunit; 6 | 7 | 8 | namespace OSharp.Develop.Tests 9 | { 10 | public class CodeRamerTests 11 | { 12 | [Fact] 13 | public void Ram_Test() 14 | { 15 | if (!OperatingSystem.IsWindows()) 16 | { 17 | return; 18 | } 19 | CodeRamer.Initialize(); 20 | string output = CodeRamer.Ram("name", 21 | () => 22 | { 23 | int sum = 0; 24 | for (int i = 1; i <= 10000; i++) 25 | { 26 | sum += i; 27 | } 28 | sum.ShouldBe(50005000); 29 | }); 30 | output.ShouldContain("\tRam:\t"); 31 | output.ShouldContain("KB"); 32 | output.ShouldContain("MB"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Develop/CodeTimerTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | using Shouldly; 4 | 5 | using Xunit; 6 | 7 | namespace OSharp.Develop.Tests 8 | { 9 | public class CodeTimerTests 10 | { 11 | [Fact] 12 | public void Time_Test() 13 | { 14 | if (!OperatingSystem.IsWindows()) 15 | { 16 | return; 17 | } 18 | CodeTimer.Initialize(); 19 | string output = CodeTimer.Time("name", 10000, () => 20 | { 21 | int sum = 0; 22 | for (int i = 1; i <= 100; i++) 23 | { 24 | sum++; 25 | } 26 | sum.ShouldBe(100); 27 | }); 28 | output.ShouldContain("CPU Cycles"); 29 | output.ShouldContain("ms"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Develop/T4/T4ModelInfoTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | using System; 4 | 5 | using OSharp.UnitTest.Infrastructure; 6 | 7 | 8 | namespace OSharp.Develop.T4.Tests 9 | { 10 | public class T4ModelInfoTests 11 | { 12 | [Fact()] 13 | public void T4ModelInfoTest() 14 | { 15 | //OSharp.UnitTest.Infrastructure 16 | const string pattern = "(?<=OSharp.).*(?=.Infrastructure)"; 17 | Type type = typeof(TestEntity); 18 | T4ModelInfo modelInfo = new T4ModelInfo(type, pattern); 19 | Assert.Equal("UnitTest", modelInfo.ModuleName); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Exceptions/ExceptionExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Xunit; 3 | 4 | 5 | namespace OSharp.Exceptions.Tests 6 | { 7 | public class ExceptionExtensionsTests 8 | { 9 | [Fact()] 10 | public void FormatMessageTest() 11 | { 12 | Exception ex = null; 13 | try 14 | { 15 | int num = 0; 16 | num = 1 / num; 17 | } 18 | catch (DivideByZeroException e) 19 | { 20 | ex = new OsharpException("服务器正忙,请稍候再尝试。", e); 21 | } 22 | Assert.True(ex != null); 23 | string msg = ex.FormatMessage(); 24 | Assert.Contains("内部异常", msg); 25 | Assert.Contains("服务器正忙", msg); 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Extensions/BooleanExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------- 2 | // 3 | // Copyright (c) 2014 OSharp. All rights reserved. 4 | // 5 | // 郭明锋 6 | // 2014:07:04 9:31 7 | // ----------------------------------------------------------------------- 8 | 9 | using Xunit; 10 | 11 | 12 | namespace OSharp.Extensions.Tests 13 | { 14 | 15 | public class BooleanExtensionsTests 16 | { 17 | [Fact()] 18 | public void ToLowerTest() 19 | { 20 | Assert.Equal("true", true.ToLower()); 21 | Assert.Equal("false", false.ToLower()); 22 | Assert.NotEqual("True", true.ToLower()); 23 | Assert.NotEqual("False", false.ToLower()); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Filter/FilterGroupTests.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | 4 | namespace OSharp.Filter.Tests 5 | { 6 | public class FilterGroupTests 7 | { 8 | [Fact()] 9 | public void FilterGroupTest() 10 | { 11 | FilterGroup group = new FilterGroup(); 12 | Assert.Equal(FilterOperate.And, group.Operate); 13 | Assert.NotNull(group.Rules); 14 | Assert.NotNull(group.Groups); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/Net/NetHelperTests.cs: -------------------------------------------------------------------------------- 1 |  2 | using System; 3 | 4 | using Xunit; 5 | 6 | namespace OSharp.Net.Tests 7 | { 8 | public class NetHelperTests 9 | { 10 | [Fact()] 11 | public void PingTest() 12 | { 13 | bool flag = NetHelper.Ping("localhost"); 14 | Assert.True(flag); 15 | } 16 | 17 | [Fact()] 18 | public void IsInternetConnectedTest() 19 | { 20 | if (!OperatingSystem.IsWindows()) 21 | { 22 | return; 23 | } 24 | 25 | bool flag = NetHelper.IsInternetConnected(); 26 | Assert.True(flag); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/TestClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | using Xunit; 8 | using Xunit.Sdk; 9 | 10 | 11 | namespace OSharp.Tests 12 | { 13 | public class TestClass 14 | { 15 | [Fact()] 16 | public void TestMethod() 17 | { 18 | 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/OSharp.Tests/Threading/ThreadExtensionsTests.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | using Xunit; 4 | 5 | 6 | namespace OSharp.Threading.Tests 7 | { 8 | public class ThreadExtensionsTests 9 | { 10 | [Fact()] 11 | public void CancelSleepTest() 12 | { 13 | var thread = new Thread(() => 14 | { 15 | try 16 | { 17 | Thread.Sleep(10000); 18 | } 19 | catch (ThreadInterruptedException) 20 | { } 21 | }); 22 | thread.Start(); 23 | Thread.Sleep(300); 24 | Assert.Equal(ThreadState.WaitSleepJoin, thread.ThreadState); 25 | thread.CancelSleep(); 26 | Thread.Sleep(300); 27 | Assert.NotEqual(ThreadState.WaitSleepJoin, thread.ThreadState); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /tests/OSharp.Tests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "OSharp": { 3 | "HttpEncrypt": { 4 | "HostPublicKey": "npBAH/wQ+CzWz0cNvt7TRroWzE4dF5TvQjQqoEa+7PutPPPsLYkHlCXlDWqv0gwGDc/vg9mzaxFFWFFKi+hMjwh1dkDIa9GVm3umB8Ris1j2yNqIvOEXDPpwbnCgqwP8HsnOwRG0Klqc3qjZlaaex0cv8XY/9v2l6qYkd9J0imtBLL+22bfPW+a/qtQfvVkNAKNm6gjLLFwkXBnw3WnBNvmpqR70fe4NtIX3gIY5uWQcD5pdBmpG1uwzCatiA2b2Gso+tr/CE5nbZ7BCofIGu4Q1JSpQTzbVnLq0+e3z3ysLNZbbXHxkcTtihKOSHhkHGnSUnJZCKHaoAlNT1tAP2Q==AQAB

", 5 | "Enabled": true 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /tests/OSharp.UnitTest.Infrastructure/AppUnitTestBase.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotnetcore/osharp/715665af25e8ac919201cc560025996a2afc7aa2/tests/OSharp.UnitTest.Infrastructure/AppUnitTestBase.cs -------------------------------------------------------------------------------- /tests/OSharp.UnitTest.Infrastructure/TestStartup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.Extensions.DependencyInjection; 3 | 4 | 5 | namespace OSharp.UnitTest.Infrastructure 6 | { 7 | public class TestStartup 8 | { 9 | public virtual void ConfigureServices(IServiceCollection services) 10 | { 11 | services.AddHttpContextAccessor(); 12 | services.AddLogging(); 13 | services.AddOSharp(); 14 | } 15 | 16 | public virtual void Configure(WebApplication app) 17 | { 18 | app.UseOSharp(); 19 | } 20 | } 21 | } 22 | --------------------------------------------------------------------------------