Edi Wang

.NET and Azure Developer

Posts in January 2017

Merge Data for N-N Relationship Tables in T-SQL

最近在整理博客的数据,需要做一个操作就是合并文章的分类。我的博客中文章和分类是多对多的关系。即一篇文章可以属于多个分类,一个分类可以包含多篇文章。这是一个很典型的多对多关系,我用的是一个多对多的表,做联合主键关联这些数据。 就像这样: 我需要做的是把“DotNetBeginner”这个分类的文章移到“CSharpAndDotNet”分类里去。但是因为原先在“DotNetBeginner”里的文章有些也是属于“CSharpAndDotNet”的,所以直接Update关联表的话,会产生重复的联合主键,就会爆。 直观一点看,写个SQL语句查询出原分类(DotNetBeginner)和目标分类(CSharpAndDotNet)中的数据: DECLARE @SourceCatId AS UNIQUEIDENTIFIER, @TargetCatId AS …
SQL SQL Server

Get system font and characters in Windows 10 UWP

There used to be a {x:Static Fonts.SystemFontFamilies} in WPF that can bind to system font list very easy. However, this is gong in UWP! How stupid it is! These days I wrote a character map UWP application, that would use system fonts, so I did some research. In order to get system font in UWP, we must use DirectX. Install these 3 NuGet pacakges into your project: "SharpDX": "3.0.1", " …
Windows UWP DirectX