掲示板


お名前
タイトル
伝言
  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.1-1; waitfor delay '0:0:15' -- 12025/02/28 07:04:30 0
Mr.(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/ 12025/02/28 07:03:51 0
Mr.10"XOR(1*if(now()=sysdate(),sleep(15),0))XOR"Z 12025/02/28 07:02:51 0
Mr.10'XOR(1*if(now()=sysdate(),sleep(15),0))XOR'Z 12025/02/28 07:02:33 0
Mr.1*if(now()=sysdate(),sleep(15),0) 12025/02/28 07:02:05 0
Mr.-1" OR 2+895-895-1=0+0+0+1 -- 12025/02/28 07:01:00 0
Mr.-1' OR 2+960-960-1=0+0+0+1 or 'Y17hig87'=' 12025/02/28 07:00:59 0
Mr.-1' OR 2+165-165-1=0+0+0+1 -- 12025/02/28 07:00:58 0
Mr.-1 OR 2+346-346-1=0+0+0+1 12025/02/28 07:00:56 0
Mr.-1 OR 2+801-801-1=0+0+0+1 -- 12025/02/28 07:00:55 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