掲示板


お名前
タイトル
伝言
  IPにより投稿が制限されています
asp.net core WebApp + Entity Framework Coreを使用しています。
EF Core + MySQLです。本家本元Oracle提供のEF Core用ライブラリが何故か動作しないので、PomeloのMySQL用ライブラリを使用しています。
テーブルはef migration addとef database updateで作成。
投稿とコメントが外部キーによりリレーションされています。
投稿             コメント
+--------+      +--------+
|   NID  |<--+  |  CID   |
+--------+   |  +--------+
|   ...  |   |  |  ...   |
+--------+   |  +--------+
             +--+  NID   |
                +--------+
投稿:コメント 1:0..n

ソース(伝言-cshtml)
ソース(伝言-model)
ソース(コメント-cshtml)
ソース(コメント-model)

public class NoticeDb : DbContext {
    public DbSet<Notice> Notices {get; set;}
    public DbSet<Comment> Comments {get; set;}
    private string conStr = @"Server=・・・";
    public NoticeDb() : base() {
    }
    public NoticeDb(string conStr) : base() {
        this.conStr = conStr;
    }
    protected override void OnConfiguring(DbContextOptionsBuilder builder) {
        builder
            .UseMySql(conStr);
    }
}
public class Notice {
    [Key]
    public int _id {get; set;}
    public string Title { get; set; }
    public string Author {get; set;}
    public string Body {get; set;}
    public DateTime Posted {get; set;}
    public virtual IList<Comment> Comments {get; set;}
}
public class Comment {
    [Key]
    public int _id {get; set;}
    public string Author {get; set;}
    public string Body {get; set; }
    public DateTime Posted { get; set; }
    [ForeignKey("Notice")]
    public int NoticeId {get; set;}
    public virtual Notice Notice { get; set; }
}



タイトル投稿者 伝言投稿日 コメント
Mr.10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z 12025/02/28 06:39:39 0
Mr.1*if(now()=sysdate(),sleep(15),0) 12025/02/28 06:39:23 0
Mr.-1" OR 2+57-57-1=0+0+0+1 -- 12025/02/28 06:39:08 0
Mr.-1' OR 2+309-309-1=0+0+0+1 or 'tEi9uGA3'=' 12025/02/28 06:39:06 0
Mr.-1' OR 2+729-729-1=0+0+0+1 -- 12025/02/28 06:39:05 0
Mr.-1 OR 2+735-735-1=0+0+0+1 12025/02/28 06:39:04 0
Mr.-1 OR 2+300-300-1=0+0+0+1 -- 12025/02/28 06:39:03 0
Mr.1 12025/02/28 06:39:01 0
Mr.1hNsGtA9D 12025/02/28 06:38:34 0
Mr.1 12025/02/28 06:38:18 0

1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55