掲示板


お名前
タイトル
伝言
  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*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15) 12025/02/28 07:09:18 0
Mr.152OqlXgF')) OR 41=(SELECT 41 FROM PG_SLEEP(15))-- 12025/02/28 07:09:01 0
Mr.1tOqZpiHx') OR 353=(SELECT 353 FROM PG_SLEEP(15))-- 12025/02/28 07:08:43 0
Mr.1hpLSGPi1' OR 451=(SELECT 451 FROM PG_SLEEP(15))-- 12025/02/28 07:08:26 0
Mr.1-1)) OR 101=(SELECT 101 FROM PG_SLEEP(15))-- 12025/02/28 07:07:55 0
Mr.1-1) OR 598=(SELECT 598 FROM PG_SLEEP(15))-- 12025/02/28 07:07:27 0
Mr.1-1 OR 411=(SELECT 411 FROM PG_SLEEP(15))-- 12025/02/28 07:06:33 0
Mr.1kCvk9LM2'; waitfor delay '0:0:15' -- 12025/02/28 07:06:13 0
Mr.1-1 waitfor delay '0:0:15' -- 12025/02/28 07:05:48 0
Mr.1-1); waitfor delay '0:0:15' -- 12025/02/28 07:05:03 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