0
0

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 5 years have passed since last update.

コードファースト時に"dbo"以外のスキーマを適用する

Last updated at Posted at 2019-06-07

表題まま。スキーマを分けたいことは多々あるが意外とやり方を知らなかったのでメモ。
実体としては単にTable属性のSchemaプロパティはデフォルトで"dbo"が割り当てられてる模様。

・以下担当者情報を保持するテーブル"Staff"をスキーマ"mst"に設定する例

[Table("Staff", Schema = "mst")]
public class Staff 
{
    [Key]
    public int ID { get; set; }
    public string Name { get; set; }
    public string KanaName { get; set; }
}

今までマスタテーブル名を接頭語(m_Staff)とかつけて管理してたのが嫌で仕方なかったけども、
これで分割もきれいになるのでうまあじ。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?