![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
.net core
小咪蜂
这个作者很懒,什么都没留下…
展开
-
.net core linux 上验证码图片不显示DrawingCore
sudo apt install libc6-dev sudo apt install libgdiplus原创 2020-08-19 23:41:12 · 667 阅读 · 0 评论 -
https://github.com/aspnet/AspNetCore
https://github.com/aspnet/AspNetCorehttps://github.com/dotnet/corefx原创 2019-11-28 18:01:29 · 500 阅读 · 0 评论 -
通过dotnet 命令添加项目,并且在vs中运行
我们这里以IdentityServer4来作为例子dotnet new -i IdentityServer4.Templates 新建模板查看模板:dotnet new -l 新建项目:dotnet new is4empty -n IdentityServer新建完项目,打开项目文件,运行:dotnet new sln -n Quickstart然后...原创 2019-11-19 22:31:39 · 1248 阅读 · 0 评论 -
RabbitMQ 生产者,消费者,持久化,分发方式
.net core 下nuget :RabbitMQ.ClientAPI:https://www.rabbitmq.com/dotnet-api-guide.htmlRabbitMQ创建exchange的方式一共有4中:direct,fanout,headers,topic.direct:直接建立发送消息fanout:将不通过路由,发送该exchange上所有绑定的队列t...原创 2019-11-18 16:47:06 · 401 阅读 · 0 评论 -
redis 高并发场景下的锁的问题
简单场景:一个下单按钮,调用API, 库存减去1对于一般的访问量不高的,代码很简单:直接从sql获取库存,然后减一,然而当并发量提高的时候,从数据库获取,再到减一的过程中,库存已经不是当时的库存了,我们可能想到很多解决办法,表锁,时间戳,代码锁,但是高并发的时候每次都请求数据库是不合理的,所以我们使用Redis。.net core 下可以引入CSRedis,我们把库存放入到内存中,这样性...原创 2019-11-17 12:11:24 · 688 阅读 · 0 评论 -
.net core 通过Attribute和接口过滤驱动方法
这两天看了CAP的源码,感觉自己和大神的差距实在太大,看源码学到的东西也很多,再也不用每天都是3层架构,一层一层的往下调用。先说下我看到的只是一点点的CAP的源码,就看了订阅这块,.net core 使用services.AddHostedService<DefaultBootstrapper>,AddHostedService是.net core 的一个后台进程,它会一直来把...原创 2019-11-06 16:12:29 · 3559 阅读 · 0 评论 -
.NET CORE AUTOMAPPER 映射一个类的子类
public class A{ public string a{set;get} public B bclass{set;get}}public class B{ public string b{set;get}}public class MapperAB{ public string a{set;get} public stri...原创 2019-09-11 16:32:11 · 638 阅读 · 0 评论 -
对于async和await的理解
直接先上代码 [HttpGet] public async Task<ActionResult<IEnumerable<string>>> GetAsync() { try { logger.LogInformation(Thread.Curre...原创 2019-08-29 22:10:57 · 807 阅读 · 0 评论 -
SmartCode 代码
用smart code 代码生成器https://github.com/dotnetcore/SmartCode,代码生成少文件,发现命令有错误dbug: SmartCode.App.BuildTasks.ProcessBuildTask[0] --------Process.FileName:powershell,Args:dotnet-format Start--------...原创 2019-06-13 11:51:04 · 614 阅读 · 0 评论 -
如何将自建建的模板上传到devops的包管理中
1.新建一个.net core 的项目 我这里直接运行dotnet new console建了一个console程序2.在项目目录中建立.templete.json文件,内容如下{ "$schema": "http://json.schemastore.org/template", "author": "Zhangfeng", "classifications":...原创 2019-09-04 15:58:41 · 287 阅读 · 0 评论 -
Cannot resolve scoped service 'dbContext' from root provider
在programme.cs 里面加入.UseDefaultServiceProvider(options => { options.ValidateScopes = false; })原创 2019-07-29 15:17:17 · 3020 阅读 · 0 评论 -
c# 扩展方法
必须定义在static 类中必须是静态方法第一个参数是调用者的类型如A.Extenstion()那么第一个参数必须是A的类型原创 2019-08-05 21:31:22 · 102 阅读 · 0 评论 -
.Net Core 实现IConfigureOptions<MyOptions> 的类如何实例化
实现IConfigureOptions<MyOptions> 的类如何实例化 public class ValuesController : ControllerBase { SqlServerOptions _options; public ValuesController(IOptions<SqlServerOptions>...原创 2019-08-08 23:26:16 · 1477 阅读 · 0 评论 -
.net core 中间件
https://www.cnblogs.com/RainingNight/p/middleware-in-asp-net-core.html public class MiddlewareTest { private readonly RequestDelegate next; public MiddlewareTest(RequestDelegate...原创 2019-08-09 16:50:15 · 201 阅读 · 0 评论 -
.net core 注入两个服务实现同一个接口,并且同时调用两个接口的实现
public void ConfigureServices(IServiceCollection services) { services.TryAddEnumerable(ServiceDescriptor.Singleton<IProcessingServer, CapProcessingServe...原创 2019-08-11 16:40:56 · 3745 阅读 · 0 评论 -
.net core 调用多个服务内的方法,通过一个其他方法统一调用
private IProcessor[] GetProcessors() { var returnedProcessors = new List<IProcessor> { _provider.GetRequiredService<TransportCheckProcessor&g...原创 2019-08-11 17:45:43 · 1811 阅读 · 0 评论 -
Snowflake
snowflake生成的ID整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由datacenter和workerId作区分)如果我们的插入完全无序,不但会导致一些中间节点产生分裂,也会白白创造出很多不饱和的节点,这样大大降低了数据库插入的性能public class SnowflakeId { public const long Twepoch...原创 2019-08-12 10:44:22 · 156 阅读 · 0 评论 -
.net core 如何像前端一样多个循环请求放到promise中,然后一次性获取,这样的异步
List<Task<string>> taskList = new List<Task<string>>(); foreach(var id in initTransfer.Ids) { string guestU...原创 2019-05-16 14:09:03 · 744 阅读 · 0 评论