-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NETとC#のバージョンアップ #60
.NETとC#のバージョンアップ #60
Conversation
global usingを使うように修正 .editorConfigのwhitespace・styleルールでフォーマット
✨✨ That's perfect, there is no visual difference! ✨✨ Check out the report here. |
} | ||
this.title = title; | ||
this.content = content; | ||
post_date = DateTime.Now; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ちょっとまだ確認まで取れなかったので、いったんメモ程度にコメント書いてます。
ご提示いただいた↓リンク。
https://learn.microsoft.com/ja-jp/aspnet/core/migration/31-to-60?view=aspnetcore-7.0&tabs=visual-studio
DateTime 値は UTC 時刻としてモデル バインドされる
というのがあって、該当(JSTにならなくなるのかと)するんじゃないかと確認中です。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
バインドされる対象はリクエストパラメータになっている項目だと思います。
サーバサイドでDateTime.Nowを設定しているものはサーバのタイムゾーンに依存して設定されます。
(ローカルだとJSTで設定されますが、Heroku環境だとタイムゾーンをJSTに設定していないため、現状はUTCになっています。ここはJSTになるように修正する必要がありそうです)
上記はDiaryテーブルのpost_dateとupdate_dateの話で、
他のDBの日時項目(アカウントロック日時)は.NETのFW仕様上、固定でUTCで登録されるされるものもあり、そちらは画面表示する際にJSTに変換して表示しています。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こちらで確認しきる前に回答いただいてありがとうございます。
このままで大丈夫そうですね。了解しました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ものすごく遅くなってしまってすみません。確認しました。
ご対応ありがとうございました。
mainメソッド廃止は、確かにあると冗長的な気はしますけど、
無いなら無いで、(関数の中に処理があるのに慣れ過ぎていて)違和感がありますね。。。
変更内容
以下のバージョンアップを行いました。
.NETのバージョンアップに伴い、使用しているライブラリもバージョンアップしています。
また、動作に影響しない範囲で以下を修正しています。
ASP.NET Coreのバージョンアップに伴う修正
C#のバージョンアップに伴う修正
その他
dotnet formatのバージョンアップに伴い、CIを修正。
StyleCopの警告箇所まで一度に修正すると確認が大変だと思ったため、
今回は従来通りのコード整形の部分(whitespaceとstyle)だけCIでチェックするように修正しています。
サブコマンドを指定しないdotnet formatを実行すると、StyleCopの警告箇所も含めて整形されるので注意。
バージョンアップにより他にもリファクタリングできるところは多そう(特にC#はだいぶ書き方が変わっているところがありそうです)で、それらについては今後少しづつ改善していきます。