0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C#のEntityからER図作ってみた

Last updated at Posted at 2023-10-09

フリーランスやってます。
最近、その年で本当にプログラムできるんですか?
と疑われることが多いので作ってみました!

トピック

  • 簡単なプログラムですが、一応クリーンアーキテクチャ(DI、テストファースト)
  • 構文解析エンジはRoslyn
  • 最速で作る

仕様

最速で作るためとにかく手抜き

  • mermaid記法のテキストを出力
  • 面倒なリレーションの記述はテンプレートファイルに記述
  • やることは、クラスのプロパティ情報をRoslynで抜き出すのみ

動かし方

  1. コードの取得&ビルド
    https://github.com/tag8851/ERGenerator

  2. テンプレートファイル作成
    サンプルを参考にしてテンプレートを作成する。
    ※@@に続いてクラス名を記述するだけ

    #サンプルテンプレートファイル     
    erDiagram
      Company ||--o{ Emp : emplyess
        @@Emp
        @@Company
    
  3. 実行
    第1引数:テンプレートファイル名
    第2引数:Entityコードフォルダ名
    第3引数:出力ファイル名

    >ERGenerator ”Samples\Sample.tmpl" "Samples" "outER.txt"
    

出力イメージ

次の展開

  • nothionへの自動アップデート
  • Roslynの深堀
  • Githubからコードを取得して完全自動化?
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?