Bubble.Library 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Bubble.Library --version 2.0.0                
NuGet\Install-Package Bubble.Library -Version 2.0.0                
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="Bubble.Library" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Bubble.Library --version 2.0.0                
#r "nuget: Bubble.Library, 2.0.0"                
#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.
// Install Bubble.Library as a Cake Addin
#addin nuget:?package=Bubble.Library&version=2.0.0

// Install Bubble.Library as a Cake Tool
#tool nuget:?package=Bubble.Library&version=2.0.0                

描述

一个帮助进行.NET Web API开发的Nuget包,正在持续完善中...<br>

功能说明

生命周期的依赖注入

  • 共有三个接口:IScopeDependency、ISingletonDependency、ITransientDependency。
  • 对于每一对Service和IService,在Service接口引入中根据需求再添加以上三种生命周期接口中的一种。
  • 在项目启动程序Program.cs中,添加示例代码实现自动依赖注入:
RegisterLifeCycle.AddCustomServices(builder.Services);
或
使用Autofac
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
builder.Host.ConfigureContainer<ContainerBuilder>(b =>
{
    b.RegisterModule<DependencyModule>();
});

EF Core

  • Entity类<br> 实体类继承Entity类可默认包含int类型的Id字段主键,若需要其他类型的主键,比如string类型,可继承Entity<string>扩展类。
  • IsDeleted接口<br> 实体类实现IsDeleted接口后,在使用EF Core查询会自动过滤IsDeleted=true的数据。
  • IHasCreationTime接口<br> 实体类实现IHasCreationTime接口后,在使用EF Core新增数据时,会自动赋值CreationTime=DateTime.Now
  • IHasModificationTime接口<br> 实体类实现IHasModificationTime接口后,在使用EF Core修改数据时,会自动赋值LastModificationTime=DateTime.Now
  • IHasDeletionTime接口<br> 实体类实现IHasDeletionTime接口后,在使用EF Core删除数据时,会自动赋值DeletionTime=DateTime.Now,同时实现IsDeleted接口的话,会将删除状态转换为修改状态,并把IsDeleted设置为true

阿里云

短信验证码

Service注入ISmsService可调用短信验证码相关函数:支持单个发送和批量发送短信验证码,批量发送一次最多支持100个。

OSS存储

Service注入IOssService可调用OSS存储相关函数:目前支持有上传图片函数,后续会更新上传文件、视频等函数。

接口统一返回类ApiResult

接口继承ApiBaseController类后,返回值会自动引入ApiResult类:

  • Result:返回值(当接口有返回值时有)
  • IsSuccess:接口执行成功标识
  • Message:错误信息,结合StringResponseException异常,抛出的错误信息会体现在这。
  • ErrorCode:错误代码
  • OperationId:操作Id

QQ

快速登录

Service注入IQQService可调用QQ相关函数,因逻辑可能每个人实现会有所不同,所以这里实现了以下四个基本的阶段函数:

  1. GetAuthorizationLink:入参QQAuthorizationCodeInputDto,返回封装好的QQ授权的链接地址<br> 注:此步骤生成的state,最好在回调接口中进行检验,可存储在redis中以便校验
  2. GetAccessTokenAsync:入参QQAccessTokenInputDto,返回QQAccessTokenOutputDto包含AccessToken等字段
  3. GetOpenIdAsync:入参QQOpenIdInputDto,返回QQOpenIdOutputDto包含OpenId等字段
  4. GetUserInfoAsync:入参QQUserInfoInputDto,返回QQUserInfoOutputDto包含QQ用户的基本信息

待更新...

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.2.0 118 11/7/2023
2.1.1 135 11/4/2023
2.1.0 122 11/3/2023
2.0.1 108 11/2/2023
2.0.0 169 9/15/2023
1.6.10 187 8/14/2023
1.6.9 151 8/14/2023
1.6.8 137 8/14/2023
1.6.7 152 8/14/2023
1.6.6 174 8/12/2023
1.6.5 161 8/7/2023
1.6.4 172 7/24/2023
1.6.3 155 7/7/2023
1.6.2 145 6/30/2023
1.6.1 141 6/28/2023
1.6.0 152 6/28/2023
1.5.0 151 6/26/2023
1.4.5 139 6/22/2023
1.4.4 136 6/22/2023
1.4.3 149 6/22/2023
1.4.2 143 6/22/2023
1.4.1 135 6/22/2023
1.4.0 138 6/21/2023
1.3.0 144 6/19/2023
1.2.0 143 6/18/2023
1.1.0 162 6/12/2023
1.0.1 147 6/8/2023
1.0.0 159 6/7/2023