自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

yuxuac的专栏

c# .net Microsoft stuff

  • 博客(239)
  • 收藏
  • 关注

转载 SQL Server - 列出所有外键

select schema_name(fk_tab.schema_id) + '.' + fk_tab.name as foreign_table, '>-' as rel, schema_name(pk_tab.schema_id) + '.' + pk_tab.name as primary_table, substring(column_names, 1, len(column_names)-1) as [fk_columns], fk.name as fk_c.

2020-07-03 09:09:54 876

转载 Javascript - JSON.stringify - Circular Structure

let cache = []; let result = JSON.stringify(pool.pool, (key, value) => { if (typeof value === 'object' && value !== null) { // Duplicate reference found, discard key if (cache.includes(value)) return; ...

2020-06-09 11:58:48 389

原创 Javascript - NodeJS - Convert buffer to stream

The most effective way:const stream = require('stream');// The bufferlet buffer = Buffer.from("Hello world!", "utf-8");// The stream from bufferlet bufferStream = new stream.PassThrough();buff...

2020-03-31 11:32:11 544

转载 Javascript - Consuming Readable Streams with Async Iterators

// https://nodejs.org/api/stream.html#stream_class_stream_passthrough// search: Consuming Readable Streams with Async Iterators(async function () { for await (const chunk of file.stream()) { ...

2020-03-30 10:44:49 176

原创 Javascript - async await

// 1. async functions always return a Promise// 2. await will return resolved data of a promise, it can be a 'data or an 'error'.// An async function: getDataPromise()const getDataPromise = (num)...

2020-03-23 08:30:40 164

转载 Javascript - Callback, Promise and Promise Chaining

// 1. Use callback in an async function, call the callback when necessary during the async call.const getValueFunc1 = (key, callback) => { setTimeout(() => { callback(null, "Data f...

2020-03-23 07:39:46 164

原创 Javascript - var function scope.

varvariables are ‘function scope.’ What does this mean? It means they are only availableinsidethe function they’re created in, or if not created inside a function, they are ‘globally scoped.’var...

2020-03-08 20:50:37 189

原创 Cassandra learning notes

Installation:https://www.youtube.com/watch?v=EEXtVn3zAqc&list=PLalrWAGybpB-L1PGA-NfFu2uiWHEsdscD&index=3Commands: 1. Start cassandra: Cassandra.bat -f 2. Open cql command li...

2020-03-03 14:00:11 185

原创 Some commands

------------New projects------------1. dotnet new classlib -n Infrastructure2. dotnet sln add Infrastructure3. dotnet add reference ../application/------------User secrets-------------1. Initia...

2020-02-12 12:04:50 137

原创 c# - 汉字数字,阿拉伯数字,相互转换

using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DesignPatterns.ChineseNumConvertor{ public class Node { public string Unit { get; set...

2020-02-02 12:57:32 2307 1

原创 c# - entityframework core - switch databases

更换数据库之后,如果旧的Migrations导致数据库错误,可按照以下步骤重新生成Migrations:1. 删除所有existing migrations(包含:DataContextModelSnapshot), 直接文件删除就可以。2. 安装要更换数据库DataProvider的nuget package,例如:SqlServer的nuget package为:Microsoft.En...

2020-01-25 13:14:08 1546

原创 c# - Entityframework Core, code first, add a new table and it's relationships.

1. Define a new class, include existing class: AppUser. public class UserFollowing { public string ObserverId { get; set; } public virtual AppUser Observer { get; set; } ...

2020-01-20 11:04:28 283

原创 c# - Asp.net Core Identity - 操作步骤

1. Define a new class, derived from IdentityUserpublic class AppUser : IdentityUser { public string DisplayName { get; set; } }2. In your DataContext, change'public class DataCo...

2020-01-11 12:29:39 1380

原创 c# - Task again

using System;using System.Threading.Tasks;namespace TestTask{ class Program { static void Main(string[] args) { T1(); T2().Wait(); T3...

2020-01-11 12:01:28 269

原创 c# - CancellationToken Demo

using System;using System.Threading;using System.Threading.Tasks;namespace TaskCancellationTest{ class Program { static void Main(string[] args) { Cancellatio...

2020-01-05 12:30:21 439

转载 VSCode - Task.json同时Build多个Projects.

https://stackoverflow.com/questions/52238171/how-to-run-multiple-tasks-in-vs-code-on-build

2019-12-27 21:04:39 1453

原创 EntityFramwork Core - Reverse Engineering

基于Db Model->Update数据库Schema:应用migration1:1. 修改你的Db Model2. 执行:Add-Migration migration1 -Context "MyDbContext"3. 执行:Update-Database -Context "MyDbContext"撤销:migration11. 执行:Update-Database ‘...

2019-12-20 13:00:11 199

原创 Using .net core with Sqlite+password

1. 在.net framework下设置Sqlite密码,访问数据,重设密码,删除密码。using System;using System.Data.SQLite;namespace ConsoleApp1{ class Program { private const string password = "abc.123"; stat...

2019-12-20 12:37:51 1600 7

原创 Asp.net Core - Custom middleware

public class PrintSomethingMiddleware { private readonly RequestDelegate _next; public PrintSomethingMiddleware(RequestDelegate next) { _next = next; }...

2019-12-15 14:41:46 151

转载 Asp.net Core - File Logging

https://nblumhardt.com/2016/10/aspnet-core-file-logger/

2019-12-15 11:18:38 231

转载 c# - Expression Tree and Why?

https://www.tutorialsteacher.com/linq/expression-treeusing System;using System.Linq.Expressions;namespace LambdaExpression{ public class Student { public string Name { get; set;...

2019-12-12 11:51:37 125

原创 C# - List of List 排列组合

public static List<List<T>> AllCombinationsOf<T>(List<List<T>> sets) { var combinations = new List<List<T>>(); forea...

2019-12-12 10:20:08 333

转载 c# - Getting Started with Entity Framework Core: Database-First Development

https://www.codeproject.com/Articles/1209903/Getting-Started-with-Entity-Framework-Core-Databas

2019-12-12 10:18:34 141

原创 c# - async, await

using System;using System.Threading;using System.Threading.Tasks;namespace AsyncAwaitDemo{ public delegate Task MyDelegate(); class Program { static async void Call() ...

2019-12-06 12:35:16 87

原创 c# - 控制台程序 合并Dll 不使用任何第三方插件

准备工作:1. 新建一个控制台程序Project:CombinedDlls.2. 再新建一个Class Library Project: ThirdPartyTool,新建一个类Util.cs, 在其中实现一个static的SayHelloTo(string name)方法。3.CombinedDlls引用ThirdPartyTool,并在代码中调用SayHelloTo方法。Sa...

2019-12-01 13:41:39 507

原创 c# - events 观察者模式

using System;namespace EventsDemo{ class Program { static void Main(string[] args) { Cat cat = new Cat() { Name = "Tom" }; Mouse mouse1 = new Mouse...

2019-11-25 13:42:52 100

原创 c# - struct和class的区别

1. struct不可以有无参数的构造函数2. 如果struct存在构造函数,所有属性必须在构造函数中初始化3. 不可以在struct中直接初始化属性4. struct可以不使用new初始化5. 若struct没有使用new初始化, 所有属性赋值之后, 对象才可以使用6. struct不可被继承7. struct可以实现接口(与class一致)8. struct是值类型,class是...

2019-11-25 11:57:41 128

原创 c# - Object Pooling(对象池)

Object pooling的主要目的是提升程序性能。代码会先从Pool中取得已经建好的对象实例,如果Pool中没有对象实例才需要重新创建,以下代码是一个示例:namespace ObjectPool{ using System; using System.Collections; class Program { static void M...

2019-11-20 15:52:16 1709

转载 标点符号 英文

转载自:http://www.ruanyifeng.com/blog/2007/07/english_punctuation.html. period or full stop 句号, comma 逗号: colon 冒号; semicolon 分号! exclamation mark 惊叹号? question mark 问号- hyphen 连字符* asterisk 星号...

2019-11-19 16:51:51 135

转载 System.web vs System.webserver 的区别是什么?

https://forums.asp.net/t/1642328.aspx?What+s+the+purposes+of+and+differences+between+system+web+and+system+webServer+

2019-11-04 18:08:36 1015

转载 Python - 时间格式

http://strftime.org/

2019-10-10 17:44:17 107

转载 python - pip install 不同 python 版本

py -2 -m pip install SomePackage # default Python 2py -2.7 -m pip install SomePackage # specifically Python 2.7py -3 -m pip install SomePackage # default Python 3py -3.4 -m pip install Some...

2019-10-08 17:34:03 508

转载 Javascript - A Set class

// 9.6.1 A Set Class function Set() { this.values = {}; this.n = 0; this.add.apply(this, arguments); } Set.prototype.add = function() { for(var i = 0 ...

2019-10-05 11:30:44 134

原创 Javascript - 继承 Inheritance

继承关系/* Java: 1. Instance fields 2. Instance methods 3. Class fields 4. Class methods Javascript: 1. Constructor object => class methods and class fields 2. ...

2019-10-04 22:40:55 126

转载 Javascript - 方法注入 Method Injection 'monkey-patching'

读Javascript: The Definitive Guide这本书的时候发现一个有意思的代码,可以在调用方法的之前和之后注入一些回调或者代码,分享给大家:// Define a method.function addBy10(val) { return val + 10;}var obj = { 'myMethod': addBy10 };obj.myMethod(5)...

2019-10-02 21:29:26 215

原创 c# - Owin Katana

https://docs.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/an-overview-of-project-katana

2019-09-23 22:39:36 239

原创 c# - 文字 中心 旋转

public static void DrawRotatedTextAt(Graphics gr, float angle, string txt, float x, float y, Font the_font, Brush the_brush) { // Text rectangle var fontRect =...

2019-09-22 17:03:07 937

转载 SQL - northwind, pub 示例数据库 脚本

https://github.com/cjlee/northwind

2019-09-05 17:52:14 469

转载 Javascript - Object Utility

/** Copy the enumerable properties of p to o, and return o.* If o and p have a property by the same name, o's property is overwritten.* This function does not handle getters and setters or copy at...

2019-09-03 23:51:59 289

转载 Python - why we use if __name__ == "__main__" in python code.

https://stackoverflow.com/questions/419163/what-does-if-name-main-do

2019-09-02 18:00:02 135

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除