{"id":19992728,"url":"https://github.com/cocosip/DotCommon","last_synced_at":"2025-05-04T11:31:48.827Z","repository":{"id":60772986,"uuid":"87805196","full_name":"cocosip/DotCommon","owner":"cocosip","description":"a c# common  util libaray","archived":false,"fork":false,"pushed_at":"2025-04-21T09:24:16.000Z","size":1752,"stargazers_count":17,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T10:22:28.034Z","etag":null,"topics":["csharp","netstandard","utils"],"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/cocosip.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-04-10T11:54:29.000Z","updated_at":"2025-02-16T19:09:16.000Z","dependencies_parsed_at":"2025-04-21T10:21:43.524Z","dependency_job_id":"b142402d-64f4-448e-8228-9ad9ee6f794e","html_url":"https://github.com/cocosip/DotCommon","commit_stats":{"total_commits":457,"total_committers":1,"mean_commits":457.0,"dds":0.0,"last_synced_commit":"9fd4a5a847ebe6433f7124f43a97b7338aa6e495"},"previous_names":[],"tags_count":56,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocosip%2FDotCommon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocosip%2FDotCommon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocosip%2FDotCommon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cocosip%2FDotCommon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cocosip","download_url":"https://codeload.github.com/cocosip/DotCommon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252329644,"owners_count":21730654,"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":["csharp","netstandard","utils"],"created_at":"2024-11-13T04:52:17.801Z","updated_at":"2025-05-04T11:31:46.464Z","avatar_url":"https://github.com/cocosip.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# DotCommon使用说明\n\n[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/cocosip/DotCommon/blob/master/LICENSE) ![GitHub last commit](https://img.shields.io/github/last-commit/cocosip/DotCommon.svg) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/cocosip/DotCommon.svg)\n\n[![build and publish](https://github.com/cocosip/DotCommon/actions/workflows/publish.yml/badge.svg)](https://github.com/cocosip/DotCommon/actions/workflows/publish.yml)\n\n| Package  | Version | Downloads|\n| -------- | ------- | -------- |\n| `DotCommon` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.svg)](https://www.nuget.org/packages/DotCommon) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.svg)|\n| `DotCommon.AutoMapper` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.AutoMapper.svg)](https://www.nuget.org/packages/DotCommon.AutoMapper) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.AutoMapper.svg)|\n| `DotCommon.Caching` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.Caching.svg)](https://www.nuget.org/packages/DotCommon.Caching) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.Caching.svg)|\n| `DotCommon.Json4Net` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.Json4Net.svg)](https://www.nuget.org/packages/DotCommon.Json4Net) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.Json4Net.svg)|\n| `DotCommon.TextJson` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.TextJson.svg)](https://www.nuget.org/packages/DotCommon.TextJson) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.TextJson.svg)|\n| `DotCommon.Log4Net` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.Log4Net.svg)](https://www.nuget.org/packages/DotCommon.Log4Net) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.Log4Net.svg)|\n| `DotCommon.ProtoBuf` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.ProtoBuf.svg)](https://www.nuget.org/packages/DotCommon.ProtoBuf) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.ProtoBuf.svg)|\n| `DotCommon.AspNetCore.Mvc` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.AspNetCore.Mvc.svg)](https://www.nuget.org/packages/DotCommon.AspNetCore.Mvc) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.AspNetCore.Mvc.svg)|\n| `DotCommon.ImageUtility` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.ImageUtility.svg)](https://www.nuget.org/packages/DotCommon.ImageUtility) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.ImageUtility.svg)|\n| `DotCommon.ImageResizer.AspNetCore.Mvc` | [![NuGet](https://img.shields.io/nuget/v/DotCommon.ImageResizer.AspNetCore.Mvc.svg)](https://www.nuget.org/packages/DotCommon.ImageResizer.AspNetCore.Mvc) |![NuGet](https://img.shields.io/nuget/dt/DotCommon.ImageResizer.AspNetCore.Mvc.svg)|\n\n## DotCommon简介\n\n\u003e DotCommon是一个 `C#` 开发的工具类库,封装了一些基本功能,能够使用该工具类库快速的进行开发项目。里面封装了很多基础的功能,如:`Json,Xml,Binary` 序列化, 依赖注入, 日志功能, 定时器, `MD5,Rsa,Base64,Aes,Des`加密解密, 拼音, 进制转换, 模拟请求, 路径转换 等功能。\n\n## 安装\n\n\u003e PM\u003e `Install-Package DotCommon`\n\n## 初始化\n\n```c#\nservices.AddLogging(c =\u003e\n{\n     c.AddLog4Net(new Log4NetProviderOptions());\n})\n.AddCommonComponents()\n.AddGenericsMemoryCache()\n.AddProtoBuf()\n.AddJson4Net();\n```\n\n## 扩展包\n\n- **Autofac依赖注入扩展包:** `DotCommon.Autofac`\n- **缓存扩展包** `DotCommon.Caching`\n- **AutoMapper自动映射扩展包** `DotCommon.AutoMapper`\n- **Json4Net序列化扩展包** `DotCommon.Json4Net`\n- **Log4Net日志扩展包** `DotCommon.Log4Net`\n- **ProtoBuf二进制序列化扩展包** `DotCommon.ProtoBuf`\n- **AspNetCore扩展** `DotCommon.AspNetCore.Mvc`\n- **ImageUtility图片扩展** `DotCommon.ImageUtility`\n- **ImageResizer图片缩放(Asp.Net Core)** `DotCommon.ImageResizer.AspNetCore.Mvc`\n\n### 扩展包使用说明\n\n- `缓存扩展`\n\n```c#\nIServiceCollection services = new ServiceCollection();\nservices\n    .AddDotCommon()\n    .AddGenericsMemoryCache();\nvar provider = services.BuildServiceProvider();\n//获取缓存管理器\nvar personCache = provider.GetRequiredService\u003cIDistributedCache\u003cPersonCacheItem\u003e\u003e();\n//根据key值获取缓存\nvar cacheItem = await personCache.GetAsync(\"key1\");\n//设置缓存\nawait personCache.SetAsync(\"key2\", cacheItem);\n```\n\n\u003e 配置缓存是基于内存:\n\n```c#\nservices.AddGenericsMemoryCache();\n\n```\n\n- `AutoMapper`对象映射扩展。`DotCommon.AutoMapper`扩展中定义了一些进行快速映射的属性,在类上面添加了这些自动映射属性,并且初始化后,就能直接进行映射使用。\n\n\u003e 初始化自动映射:\n\n```c#\n//需要进行自动映射的程序集\nvar assemblies=new List\u003cAssembly\u003e();\n\nIServiceCollection services = new ServiceCollection();\nservices\n    .AddDotCommon()\n    .AddDotCommonAutoMapper()\n    .AddAssemblyAutoMaps(assemblies.ToArray())\n    .AddAutoMapperConfigurator(c =\u003e\n    {\n        //自定义的一些AutoMapper配置\n    })\n    .BuildAutoMapper();\nvar provider = services.BuildServiceProvider();\n\n```\n\n## 数据库参数与字段说明\n\n\u003e 数据库参数与字段说明 [详见](/docs/database.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocosip%2FDotCommon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcocosip%2FDotCommon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcocosip%2FDotCommon/lists"}