后端 文章

yum的基本使用以及替换国内源
后端
2019-05-16 0k

yum的基本使用以及替换国内源

yum源管理 1.备份原有的yum源,以防出错时还可以还原 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup 2.下载同时改名 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo #其他源 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo #centos7系统的 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo #centos6系统的 wget http://mirrors.163.com/.help/CentOS5-Base-163.repo #centos5系统的 (注:如果下载出现错误,可能是变更了下载的地址,可以到:http://mirrors.163.com/.help/centos.html 找新的下载地址。没有安装wget的,要先安装。) 3.产生新的缓存。 yum clean all yum makecache 至此源更新完成,可以 yum -y update 测试一下更新的速度。 安装软件 以安装Docker为例 安装最新版 yum install -y docker-ce docker-ce-cli containerd.io 安装指定版本 列出可用版本 $ yum list docker-ce --showduplicates | sort -r docker-ce.x86_64 3:18.09.1-3.el7 docker-ce-stable docker-ce.x86_64 3:18.09.0-3.el7 docker-ce-stable docker-ce.x86_64 18.06.1.ce-3.el7 docker-ce-stable docker-ce.x86_64 18.06.0.ce-3.el7 docker-ce-stable 安装指定版本 <VERSION_STRING>需要替换为第二列的版本号,如:18.06.0.ce-3.el7 $ sudo yum install docker-ce-<VERSION_STRING> docker-ce-cli-<VERSION_STRING> containerd.

linux yum 包管理
阅读更多
Net Core 3.x 禁用序列化时自动首字母小写
后端
2019-03-11 0k

Net Core 3.x 禁用序列化时自动首字母小写

public void ConfigureServices(IServiceCollection services) { services.AddControllers().AddJsonOptions(config => { //去掉转小写功能 // System.Text.Json.JsonNamingPolicy.CamelCase:转小写 // null:不转小写 config.JsonSerializerOptions.PropertyNamingPolicy =null; }); }

dotnet .NET Core 序列化
阅读更多
NuGet源中国加速镜像,博客园,华为等
后端
2019-03-11 0k

NuGet源中国加速镜像,博客园,华为等

打开Visual Studio => 工具 => NuGet包管理器 => 程序包管理器设置 NuGet微软官方中国镜像地址: https://nuget.cdn.azure.cn/v3/index.json 官方默认源: https://api.nuget.org/v3/index.json 博客园: https://nuget.cnblogs.com/v3/index.json 华为: https://repo.huaweicloud.com/repository/nuget/v3/index.json MyNuGet: https://dotnet.myget.org/F/dotnet-core/api/v3/index.json 这是一个很激进的 NuGet 源,包含各种日构建包(其中包括 .NET Standard 或者 .NET Core 等库的日构建版本),所以如果你希望尝试最新的 API 最新的功能,最好设置此 NuGet 源。 早期版本: https://www.nuget.org/api/v2/ https://nuget.org/api/v2/

dotnet NuGet 包管理
阅读更多
DotNet Core AutoMapper实体映射学习记录
后端
2018-03-11 0k

DotNet Core AutoMapper实体映射学习记录

AutoMapper:实体间的映射(数据库Model转Dto) 1、创建Model using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace AutoMapperDemo { public class Entity { } public class PostModel { public Guid Id { get; set; } public long SerialNo { get; set; } public string Title { get; set; } public string Author { get; set; } public string Image { get; set; } public short CategoryCode { get; set; } public bool IsDraft { get; set; } public string Content { get; set; } public DateTime ReleaseDate { get; set; } public virtual IList<CommentModel> Comments { get; set; } } public class CommentModel { public Guid Id { get; set; } public string Email { get; set; } public string Content { get; set; } public DateTime CommentDate { get; set; } } } 2、创建Dto using System; using System.

dotnet AutoMapper 实体映射
阅读更多
DotNet Framework 类库 自带的缓存 HttpRuntime.Cache HttpContext.Cache
后端
2017-03-11 0k

DotNet Framework 类库 自带的缓存 HttpRuntime.Cache HttpContext.Cache

系统自带两个cache类 在.NET运用中经常用到缓存(Cache)对象。有HttpContext.Current.Cache以及HttpRuntime.Cache,HttpRuntime.Cache是应用程序级别的,而HttpContext.Current.Cache是针对当前WEB上下文定义的。HttpRuntime下的除了WEB中可以使用外,非WEB程序也可以使用。 HttpRuntime.Cache 相当于就是一个缓存具体实现类,这个类虽然被放在了 System.Web 命名空间下了。但是非 Web 应用也是可以拿来用的。 HttpContext.Cache 是对上述缓存类的封装,由于封装到了 HttpContext ,局限于只能在知道 HttpContext 下使用,即只能用于 Web 应用。 综上所属,在可以的条件,尽量用 HttpRuntime.Cache ,而不是用 HttpContext.Cache 。 缓存数据规则 数据可能会被频繁的被使用,这种数据可以缓存。 数据的使用频率不高,但 生存周期很长,这样的数据也可以加入缓存。 封装Helper /* * 日期:2016-06-27 */ using System; using System.Web; using System.Collections; public class CacheHelper { /**/ /// <summary> /// 获取数据缓存 /// </summary> /// <param name="CacheKey">键</param> public static object GetCache(string CacheKey) { System.Web.Caching.Cache objCache = HttpRuntime.

dotnet 缓存 缓存机制
阅读更多