CVSolution.SocketExtension
1.0.0-pre3
This is a prerelease version of CVSolution.SocketExtension.
dotnet add package CVSolution.SocketExtension --version 1.0.0-pre3
NuGet\Install-Package CVSolution.SocketExtension -Version 1.0.0-pre3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CVSolution.SocketExtension" Version="1.0.0-pre3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CVSolution.SocketExtension" Version="1.0.0-pre3" />
<PackageReference Include="CVSolution.SocketExtension" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CVSolution.SocketExtension --version 1.0.0-pre3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CVSolution.SocketExtension, 1.0.0-pre3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CVSolution.SocketExtension@1.0.0-pre3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CVSolution.SocketExtension&version=1.0.0-pre3&prerelease
#tool nuget:?package=CVSolution.SocketExtension&version=1.0.0-pre3&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CVSolution
介绍
尽可能的让开发人员专注于业务代码,其他的只需要Ctrl+C、Ctrl+V,改改参数就能跑。 平时新写一个程序的时候,需要从以往的程序中复制很多代码出来,比如数据库操作类,各种Extension及其他工具类,我是不想总是复制的,不仅是因为太过麻烦,更是因为时间久了后,各操作类的代码都可能不同了,所以我将平时可能用到的全部打包集成起来,按需要添加就好,方便又快捷~
软件架构
- CVSolution:主项目
- CVSolution.KafkaExtension:Kafka扩展
- CVSolution.SocketExtension:Socket扩展
- CVSolution.SqlSugarExtension:SqlSugar扩展
- CVSolution.NLogExtension:NLog扩展
- CVSolution.ElasticsearchExtension:Elasticsearch扩展
使用说明
- 开始(个人习惯)
using CVSolution;
public class Program
{
public static void Main(string[] args)
{
Console.Title = "程序名称";
Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN", true)
{
DateTimeFormat =
{
ShortDatePattern = "yyyy-MM-dd",
FullDateTimePattern = "yyyy-MM-dd HH:mm:ss",
LongTimePattern = "HH:mm:ss"
}
};
Console.WriteLine($"[{DateTime.Now.ToCstTime():yyyy-MM-dd HH:mm:ss}]程序开始");
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
- IOC注入
using CVSolution;
private AppConfig appConfig;
public void ConfigureServices(IServiceCollection services)
{
appConfig = ConfigTool.Instance.AddJsonFile<AppConfig>("AppConfig", false, true);
services.AddSingleton(appConfig);
services.AddControllers(); // 控制器
services.AddHttpClient(); // Http客户端
//跨域
services.AddCors(options =>
{
options.AddDefaultPolicy(
builder =>
{
builder.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()
//预检请求缓存时长
.SetPreflightMaxAge(new TimeSpan(0, 10, 0));
});
});
if (appConfig.IsSwagger)
{
services.AddSwaggerGen();
}
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseRouting();
if (appConfig.IsSwagger)
{
app.UseSwagger();
app.UseSwaggerUI();
}
//跨域
app.UseCors();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
- xxxx
特技
- 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
- Gitee 官方博客 blog.gitee.com
- 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
- GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
- Gitee 官方提供的使用手册 https://gitee.com/help
- Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- CVSolution (>= 1.0.0-pre7)
- System.IO.Pipelines (>= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0-pre3 | 106 | 2/2/2024 |
1.0.0-pre2 | 87 | 4/16/2024 |
1.0.0-pre1 | 85 | 9/21/2023 |