• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
PowerCoder
博客园    首页    新随笔    联系   管理    订阅  订阅
02 2020 档案
SQL Server中使用msdb数据库的存储过程sp_delete_backuphistory和sp_delete_database_backuphistory来删除备份和恢复历史数据

摘要:根据微软文档对sp_delete_backuphistory存储过程的介绍,SQL Server在每次备份和恢复数据库后,会向msdb系统数据库的备份和恢复历史表写入数据,如果SQL Server经常要做频繁的备份和恢复操作,会造成msdb系统数据库逐渐变大,所以微软建议定期调用msdb数据库的存储 阅读全文
posted @ 2020-02-27 19:04 PowerCoder 阅读(1012) 评论(0) 推荐(0)
DateTimeOffset的构造函数抛出异常:UTC offset of local dateTime does not match the offset argument(转载)

摘要:DateTimeOffset Error: UTC offset of local dateTime does not match the offset argument 问: I'm trying to create a small method that converts the time fr 阅读全文
posted @ 2020-02-27 14:40 PowerCoder 阅读(840) 评论(0) 推荐(0)
C#中,接口转换实验

摘要:在C#中,接口是一个比较特殊的存在,一个接口的实例,可以转换为没有实现该接口的类,并且不会发生编译错误。 为此,我们新建一个.NET Core控制台项目,然后使用如下代码来进行实验: using System; namespace NetCoreInterfaceTypeConversion { / 阅读全文
posted @ 2020-02-23 14:30 PowerCoder 阅读(1135) 评论(0) 推荐(0)
在SQL Server的子查询、视图、内联函数等数据库对象中,不应该单独使用ORDER BY语句

摘要:我们知道在SQL语句中,ORDER BY语句可以用来排序。但是在SQL Server中,如果我们在子查询、视图、内联函数等数据库对象中单独使用ORDER BY语句是不允许的,来看下面的SQL语句: SELECT * FROM ( SELECT [ID],[Code],[Name],[Age],[Se 阅读全文
posted @ 2020-02-19 12:06 PowerCoder 阅读(2289) 评论(0) 推荐(0)
EF Core中如何使用LEFT JOIN

摘要:我们知道使用EF Core的Join函数可以实现SQL中的INNER JOIN,那么怎么实现LEFT JOIN呢? 答案就在GroupJoin、SelectMany和DefaultIfEmpty三个Linq函数的组合使用上。 下面我们举个例子,建立一个.NET Core控制台项目,来演示使用EF C 阅读全文
posted @ 2020-02-17 22:59 PowerCoder 阅读(18307) 评论(3) 推荐(4)
.NET Core版本兼容问题(链接)

摘要:下面的文章,很好地阐述了.NET Core各个版本之间的兼容问题: Is .NET Core Runtime backwards compatible with previous releases? 阅读全文
posted @ 2020-02-15 17:51 PowerCoder 阅读(1923) 评论(0) 推荐(0)
TransactionScope and database connections(转载)

摘要:问 Do TransactionScope work with closed database connections? using (var transaction = new TransactionScope(TransactionScopeOption.Required)) { // crea 阅读全文
posted @ 2020-02-14 14:22 PowerCoder 阅读(230) 评论(0) 推荐(0)
Async/Await模式中使用TransactionScope时,要设置参数为TransactionScopeAsyncFlowOption.Enabled枚举(转载)

摘要:TransactionScope and Async/Await. Be one with the flow! You might not know this, but the 4.5.0 version of the .NET Framework contains a serious bug re 阅读全文
posted @ 2020-02-13 19:56 PowerCoder 阅读(1346) 评论(0) 推荐(0)
Does disposing StreamReader or StreamWriter close the stream?(转载)

摘要:问 I am sending a stream to methods to write on, and in those methods I am using a binary reader/wrtier. When the reader/writer gets disposed, either b 阅读全文
posted @ 2020-02-12 14:47 PowerCoder 阅读(462) 评论(0) 推荐(0)
使用自定义的行分隔符,从StreamReader中读取一行字符串

摘要:在C#中,StreamReader的ReadLine方法是不支持自定义行分隔符的。这导致很多文本文件的行分隔符如果不是"\r"和"\n",那么使用StreamReader就无法正确读取到一行字符串。 所以我们这里采用一个.NET Core控制台项目,自定义一个ReadLineWithDelimite 阅读全文
posted @ 2020-02-12 12:03 PowerCoder 阅读(1325) 评论(0) 推荐(0)
Static files in ASP.NET Core - ASP.NET Core中的静态文件处理(链接)

摘要:微软官网的这篇文章阐述了,在ASP.NET Core中的静态文件处理: Static files in ASP.NET Core 注意其中有几点很有用: 使用FileExtensionContentTypeProvider,来自定义静态文件扩展名的映射 启用非标准静态文件类型,可以让ASP.NET 阅读全文
posted @ 2020-02-09 00:33 PowerCoder 阅读(328) 评论(0) 推荐(0)
SQL Server和C#中无法将小数字符串直接转换为整数类型

摘要:有时候我们会将一个小数字符串转换为整数,例如将"31.0"转换为整数类型,因为这个小数本来就是一个整数,它的小数位为0。 SQL Server 如果我们在SQL Server中直接将字符串'31.0'转换为INT类型,会报错: DECLARE @text NVARCHAR(50)=N'31.0' S 阅读全文
posted @ 2020-02-08 21:45 PowerCoder 阅读(1520) 评论(0) 推荐(0)
Is default(CancellationToken) equivalent to CancellationToken.None?(转载)

摘要:问 Looking at the implementation of CancellationToken.None, it is simply returning default(CancellationToken). However, I see no reference in Cancellat 阅读全文
posted @ 2020-02-07 01:16 PowerCoder 阅读(346) 评论(0) 推荐(0)
Stored Procedures: OUTPUT vs OUT?(转载)

摘要:问 I've seen in BOL under the section regarding Stored Procedures, specifically declaring OUTPUT parameters, where both "OUTPUT" and "OUT" are used.Is 阅读全文
posted @ 2020-02-06 17:11 PowerCoder 阅读(217) 评论(0) 推荐(0)
关于TransactionScope.Complete方法(链接)

摘要:相信有些同学会困扰,当我们执行TransactionScope.Complete()方法的时候,是否Transaction被真正提交到数据库了。 对于这一点,MSDN上有这么一段描述: If the TransactionScope object created the transaction in 阅读全文
posted @ 2020-02-06 11:28 PowerCoder 阅读(635) 评论(0) 推荐(0)
Do I need to dispose of Tasks?(链接)

摘要:Do I need to dispose of Tasks? Here’s my short answer to this question: “No. Don’t bother disposing of your tasks.” 阅读全文
posted @ 2020-02-05 15:30 PowerCoder 阅读(183) 评论(0) 推荐(0)
EF Core 3.0 Keyless Entity Types (链接)

摘要:Keyless Entity Types 阅读全文
posted @ 2020-02-05 11:50 PowerCoder 阅读(588) 评论(0) 推荐(0)
为什么C#接口中不能声明async异步函数(转载)

摘要:Unable to declare Interface “ async Task<myObject> MyMethod(Object myObj); ” 问 I'm unable to declare interface IMyInterface { async Task<myObject> MyM 阅读全文
posted @ 2020-02-04 16:00 PowerCoder 阅读(2481) 评论(0) 推荐(0)

博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3