dotnet-ef summary

Instal dotnet-ef

dotnet tool install -g dotnet-ef --version 3.1.1

Add Migration

dotnet-ef migrations add migration-name [-c SomeDbContext]

Update Database

dotnet-ef update database [migration-name] [-c SomeDbContext]

Revert All Database Update

dotnet-ef update database 0 [-c SomeDbContext]

Windows is still a buggy and uncomfortable OS in 2020

I would like to give Windows 10 a try after the promise 12 years ago. I got a job a month ago, and I need to write ASP.NET Core application for this job. Though Asp.NET core and C# taste good, windows 10 makes me upset once more.

Twelve years ago, that was the year 2008, I left windows XP for Arch Linux. I promised I will never use Windows as my main OS in the future at that time. My boss bought me an excellent DELL laptop with 32GB memory and equipped a 15" 4k screen. Yes, it is preinstalled with Windows 10 Professional.

Today I have installed autojump, Wrox on windows 10, and changed a few settings here and there to reach my requirements. I know I may insist on Windows for a bit long time because I need the job to live and I should give Windows another go. I hope I can feel better later. The Windows 10 system does improve a lot than its previous version, however, the feeling, I cannot tell. Another long way to go, or it may never be perfect.

Good luck to me, and to windows.

Windows 10 小狼毫(RIME)安装五笔拼音输入法

  1. https://rime.im/ 下载安装
  2. 右键点击“中”字图标,在弹出菜单中点击“输入法设定”
  3. 在弹出窗口中点击“获取更多输入方案”,这时会弹出一个 cmd 窗口让你输入需要添加的方案
  4. 先输入 rime-wubi 回车,wubi就自动装上了
  5. 再输入 rime-pinyin-simp 回车,拼音也装上了。
  6. 回车并随手关掉这个 cmd 窗口,加输入法的工作就完成了。
  7. 回到刚才点击 “获取更多输入方案” 的窗口,勾掉你不需要的那些七七八八的输入法,选中刚刚添加上的“五笔拼音”,然后再点一下 “中”按钮 (不是右下角的“中”图标),选择一个你喜欢的风格。

Mission Accomplished!

Enjoy 你的五笔拼音吧! (By the way,写此Blog时我用的小狼毫版本是 0.14.3 )

CentOS 7 firewall-cmd open a port permanently

    [root@centos7 ~]# firewall-cmd --permanent --add-port=100/tcp
    success
    [root@centos7 ~]# firewall-cmd --reload
    success

From how-to-open-a-port-in-centos-7-with-firewalld

Tips for dotnet user-secrets

  • On the Windows platform, the secrets file are saved at /Users/yourusername/%APPDATA%/Microsoft/UserSecrets/{projectid}/secrets.json;
  • On Linux/Mac platform, the secrets file are saved at ~/.microsfot/usersecrets/{projectid}/secrets.json.

Believe it or not, .NET Core console application doesn't support user secrets in its default configuration. You can use dotnet command set or list your secrets, but actually, you cannot get its value through the IConfiguration object. What's a shame!

Finally, you may want to import secrets from one project to another project. I just wrote a small single-file script to save myself. Certainly, you can also use it if you like.

The tool has been published on Github, here it is.