{"id":19992993,"url":"https://github.com/VictorTzeng/Zxw.Framework.NetCore","last_synced_at":"2025-05-04T12:30:34.422Z","repository":{"id":63647350,"uuid":"107011097","full_name":"VictorTzeng/Zxw.Framework.NetCore","owner":"VictorTzeng","description":"基于EF Core的Code First模式的DotNetCore快速开发框架，其中包括DBContext、IOC组件autofac和AspectCore.Injector、代码生成器（也支持DB First）、基于AspectCore的memcache和Redis缓存组件，以及基于ICanPay的支付库和一些日常用的方法和扩展，比如批量插入、更新、删除以及触发器支持，当然还有demo。欢迎提交各种建议、意见和pr~","archived":false,"fork":false,"pushed_at":"2023-10-10T11:14:00.000Z","size":17069,"stargazers_count":764,"open_issues_count":11,"forks_count":247,"subscribers_count":56,"default_branch":"master","last_synced_at":"2025-04-14T03:07:48.301Z","etag":null,"topics":["aspectcore","autofac","code-generator","codefirst","dotnetcore","efcore","ioc","memcached","mongodb","mysql","oracle","postgresql","redis","sqlite","sqlserver"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VictorTzeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-10-15T12:42:52.000Z","updated_at":"2025-03-05T00:51:56.000Z","dependencies_parsed_at":"2022-11-23T04:23:06.878Z","dependency_job_id":"78498e4e-1491-4d81-af1f-02bd40927c49","html_url":"https://github.com/VictorTzeng/Zxw.Framework.NetCore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorTzeng%2FZxw.Framework.NetCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorTzeng%2FZxw.Framework.NetCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorTzeng%2FZxw.Framework.NetCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VictorTzeng%2FZxw.Framework.NetCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VictorTzeng","download_url":"https://codeload.github.com/VictorTzeng/Zxw.Framework.NetCore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252334006,"owners_count":21731313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aspectcore","autofac","code-generator","codefirst","dotnetcore","efcore","ioc","memcached","mongodb","mysql","oracle","postgresql","redis","sqlite","sqlserver"],"created_at":"2024-11-13T04:52:25.171Z","updated_at":"2025-05-04T12:30:32.890Z","avatar_url":"https://github.com/VictorTzeng.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# Zxw.Framework.NetCore\n[![Build Status](https://dev.azure.com/v-xiaze0473/v-xiaze/_apis/build/status/VictorTzeng.Zxw.Framework.NetCore?branchName=master)](https://dev.azure.com/v-xiaze0473/v-xiaze/_build/latest?definitionId=1\u0026branchName=master)\n\n基于EF Core的Code First模式的DotNetCore快速开发框架\n\n**Nuget [最新版本：6.1.0]**\n\n[Zxw.Framework.NetCore](https://www.nuget.org/packages/Zxw.Framework.NetCore/6.1.0) \n* Install-Package Zxw.Framework.NetCore -Version 6.1.0\n* dotnet add package Zxw.Framework.NetCore --version 6.1.0\n\n**开发环境**\n* VS2019 / VS Code\n* .net core 3.1.100\n\n**支持的数据库**\n* SQL Server\n* MySQL\n* Sqlite\n* InMemory\n* PostgreSQL\n* Oracle\n* MongoDB (已移除)\n\n**日志组件**\n* log4net\n\n**DI组件**\n* Autofac\n* [Aspectcore.Injector](https://github.com/dotnetcore/AspectCore-Framework/blob/master/docs/injector.md)\n\n**AOP缓存组件使用**\n\n本项目采用的AOP中间件 ：[AspectCore.Extensions.Cache](https://github.com/VictorTzeng/AspectCore.Extensions.Cache)\n\n# 示例\n* [Zxw.Framework.NetCore.Demo](https://github.com/VictorTzeng/Zxw.Framework.NetCore.Demo)\n\n\n# .net framework版本地址\n* [Zxw.Framework.Nfx](https://github.com/VictorTzeng/Zxw.Framework.Nfx)\n\n# 项目说明\n* 请参考我的博客：[http://www.cnblogs.com/zengxw/p/7673952.html](http://www.cnblogs.com/zengxw/p/7673952.html)\n\n# 更新日志\n\n**2022/11/20**\n* 1.兼容.net7.0，\n* 2.移除对MongoDB的支持\n* 3.HttpRequestHelper标识为已过时，请用HttpClient\n\n**2019/12/17**\n* 1. 添加框架同一入口扩展方法 [AddCoreX](https://github.com/VictorTzeng/Zxw.Framework.NetCore/blob/66ce81a3ffa3eb9379631ba11a3fd36c4c369e60/Zxw.Framework.NetCore/Extensions/ServiceExtension.cs#L419)\n```\nservices.AddCoreX(config=\u003e { })\n```\n\n* 2. AddCoreX方法里面默认开启注入实现了ISingletonDependency、IScopedDependency、ITransientDependency三种不同生命周期的类，以及AddHttpContextAccessor和AddDataProtection。如需要自动注入，只需要按需实现ISingletonDependency、IScopedDependency、ITransientDependency这三种生命周期接口即可。\n\n* 3. 添加会话上下文 [WebContext](https://github.com/VictorTzeng/Zxw.Framework.NetCore/blob/master/Zxw.Framework.NetCore/Web/WebContext.cs)\n\n* 4. 升级 [AspectCore](https://github.com/dotnetcore/AspectCore-Framework) 至 2.0.0\n\n* 5. 示例 [Zxw.Framework.NetCore.Demo](https://github.com/VictorTzeng/Zxw.Framework.NetCore.Demo) 已同步更新。\n\n**2019/09/16**\n* 1.更换Oracle for efcore驱动，使用Oracle官方驱动\n\n**2019/09/15**\n* 1.重构AOP缓存，统一用CachedAttribute\n\n**2019/08/11**\n* 1.重构代码生成器，分CodeFirst和DbFirst\n\n a.启用代码生成器\n```\n\n//启用代码生成器\nservices.UseCodeGenerator(new CodeGeneratorOption());\n\n```\n\n b.使用代码生成器\n \n```\n\n//CodeFirst---根据model生成其他各层的代码\ndbContext.CodeFirst().GenerateAll(ifExsitedCovered:true);\n\n//DbFirst---根据现有数据表生成各层代码\ndbCOntext.DbFirst().GenerateAll(ifExsitedCovered:true);\n\n```\n* 2.添加对APIController的代码生成\n\n**2019/04/25**\n* 1.修改缓存拦截器默认key格式为：{namespace}{class}{method}{参数值hashcode}\n* 2.缓存拦截器添加对Task\u003c\u003e类型的支持\n\n\n**2019/04/18**\n* 1.删除触发器功能...\n* 2.实现多数据库上下文。用法：\n\n```\n    //注入数据库上下文\n    services.AddDbContextFactory(factory =\u003e\n    {\n        factory.AddDbContext\u003cPostgreSQLDbContext\u003e(\"db1\", new DbContextOption(){ConnectionString = \"User ID=postgres;Password=123456;Host=localhost;Port=5432;Database=ZxwPgDemo;Pooling=true;\" });\n        factory.AddDbContext\u003cSqlServerDbContext\u003e(\"db2\", new DbContextOption() { ConnectionString = \"\" });\n        factory.AddDbContext\u003cMongoDbContext\u003e(\"db3\", new DbContextOption() { ConnectionString = \"\" });\n    });\n\n\n    //获取\n    public class TestController\n    {\n        public IDbContextCore DbContext1 { get; set; }\n        public IDbContextCore DbContext2 { get; set; }\n        public IDbContextCore DbContext3 { get; set; }\n\n        public TestController(DbContextFactory factory)\n        {\n            DbContext1 = factory.GetDbContext(\"db1\");\n            DbContext2 = factory.GetDbContext(\"db2\");\n            DbContext3 = factory.GetDbContext(\"db3\");\n        }\n\n        public void Run()\n        {\n            var db = DbContext1.GetDatabase();\n            Console.WriteLine();\n        }\n    }\n```\n\n* 3.多数据库上下文支持属性注入,用法如下：（具体请参考单元测试）\n```    \npublic class TestRepository: BaseRepository\u003cMongoModel, ObjectId\u003e, IMongoRepository\n    {\n        [FromDbContextFactory(\"db1\")]\n        public IDbContextCore DbContext1 { get; set; }\n        [FromDbContextFactory(\"db2\")]\n        public IDbContextCore DbContext2 { get; set; }\n        [FromDbContextFactory(\"db3\")]\n        public IDbContextCore DbContext3 { get; set; }\n\n\n\n        public void Run()\n        {\n            Console.WriteLine(\"Over!\");\n        }\n\n        public TestRepository(IDbContextCore dbContext) : base(dbContext)\n        {\n        }\n    }\n```\n\n**2018/09/24**\n* 1.实现Oracle for EfCore，引用第三方驱动[Citms.EntityFrameworkCore.Oracle](https://github.com/CrazyJson/Citms.EntityFrameworkCore.Oracle)\n* 2.实现MongoDB for EfCore，引用第三方驱动[Blueshift.EntityFrameworkCore.MongoDB](https://github.com/BlueshiftSoftware/EntityFrameworkCore)\n\n**2018/08/26**\n* 1.添加自定义视图分页查询，数据库分页，目前只支持sqlserver\n* 2.update packages\n\n**2018/07/06 合并dev分支到master**\n* 1.添加EFCore直接返回[DataTable](https://github.com/VictorTzeng/Zxw.Framework.NetCore/blob/d99b321006ad7ee12883e92742d3ef1fe44968f7/Zxw.Framework.NetCore/Extensions/EntityFrameworkCoreExtensions.cs#L20)功能\n* 2.DBFirst功能，目前仅支持SQL Server、MySQL、NpgSQL三种数据库。根据已存在的数据表直接生成实体代码，详见[CodeGenerator](https://github.com/VictorTzeng/Zxw.Framework.NetCore/blob/b07589d550a9f757b8da75e4fc685b917be29f34/Zxw.Framework.NetCore/CodeGenerator/CodeGenerator.cs#L197)\n* 3.添加单元测试项目，并完成对以上两点新功能的测试\n* 4.引入IOC容器[Aspectcore.Injector](https://github.com/dotnetcore/AspectCore-Framework/blob/master/docs/injector.md)，详见[AspectCoreContainer.cs](https://github.com/VictorTzeng/Zxw.Framework.NetCore/blob/master/Zxw.Framework.NetCore/IoC/AspectCoreContainer.cs)\n\n# 开源协议\n* 本开源项目遵守[MIT](https://github.com/VictorTzeng/Zxw.Framework.NetCore/blob/master/LICENSE)开源协议，请保留原作者出处。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVictorTzeng%2FZxw.Framework.NetCore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FVictorTzeng%2FZxw.Framework.NetCore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FVictorTzeng%2FZxw.Framework.NetCore/lists"}