Dotnet Core

EF Core with MySQL Specified key was too long; max key length is 3072 bytes

今日嘗試使用 EF Core with MySQL 時出現了以下的錯誤信息: MySql.Data.MySqlClient.MySqlException HResult=0x80004005 Message=Specified key was too long; max key length is 3072 bytes Source=MySql.Data StackTrace: at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId) at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) at MySql.Data.MySqlClient.MySqlDataReader.NextResult() at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary<strong>2 parameterValues) at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary</strong>2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary<strong>2 parameterValues) at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IEnumerable</strong>1 migrationCommands, IRelationalConnection connection) at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.CreateTables() at Microsoft.EntityFrameworkCore.Storage.RelationalDatabaseCreator.EnsureCreated() at Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade.EnsureCreated() at epm.Api.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ApplicationDbContext dbContext) in C:\Users\yauch\Documents\git\docker-easy-property\api\src\server\epm.Api\Startup.cs:line 65 我是使了了 Official 的 NuGet Package “MySql.Data.EntityFrameworkCore " 做了一會 research 之後發現… 是這一個 package 的問題 解決方法十分簡單.. 我們只需要用另一個 nuget package 便可”Pomelo.EntityFrameworkCore.MySql" https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql

2019-02-10

Code-Playground

發覺返到香港越來越難集中去做自己既 project 連 blog 都少寫了 今日終於逼自己係 GitHub 度開個 repository 去寫下 code 希望每星期都會 commit 到 D code 同有 blog post share 個 project 叫做 Code-Playground 主要是用來 share 自己想寫既 project 但係因為自己個根基比較弱.. 上網跟住 D Tutorial blog post 有時可能 version / setup 問題 或是我想做的 feature 比較複雜 所以都係做唔到 Expected result

2019-01-02

ASP.Net Core Enable Development Error

由於不太了解 ASP.Net Core with Angular / React Webpack 的關係 當遇到有 Angular / React的問題是都不知道那裡出錯 我的Angular / ReactJs Project 是用 dotnet core 的 SPA template 建立的 過了幾天才發現.. 由於是使用 dotnet run 或 dotnet watch run 的關係 所以執行的 port 和 visual studio 執行時 debug 的 port 不一樣.. 可能是這樣所以被定義為不是 development mode 所以網頁的 error 便被隱藏了

2017-07-01

ASP.net Core SPA Single Page Application Template Generator with angular, aurelia, knockout, react

最近開始學 Angular 4 / React 但是不知道怎樣開始 如果只是React / Angular 的 CLI 來產生他們的 Project Template 的話 自己便要再起一個Node JS 的 backend 來 serve data 了 安裝方法: 我們可以在 Command prompt 執行以下指令 dotnet new --install Microsoft.AspNetCore.SpaTemplates::* 之後便可以執行以下指令 去看看有什麼 Template 可以使用

2017-06-20

dotnet watch does not refresh content for AspNetCore.SpaTemplates React / Angular

最近使用了 ASP.Net Core 的 SPA Template 來學習 ReactJs 因為我可以使用 ASP.Net Core 來做 Web API.. 而 ReactJs 來做 Web Front End 之後便可以 deploy 到 Azure 十分方便.. 又可以很快看到效果 ASP.Net Core App can NOW be deploy to Azure – (Azure web app)

2017-06-04

Enable dotnet watch - on asp.net core

最近開始學習 .Net Core 的 ASP.Net Core 發現現在.net 越來越方便了 之前開發 asp.net 的 web application 時每當要更改程式碼 時 都有需要停止 debug之後更重新開始debug.. 感覺開發.net application 需要的時間比較長 不像使用 node.js一樣..可以使用 gulp或grunt 來檢查程式碼有沒有更新 如果有的話便會 re-compile 等等 之後只要 refresh browser 便會自看到程式碼所做的更新

2017-05-31