掲示板


お名前
タイトル
伝言
  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-1)) OR 413=(SELECT 413 FROM PG_SLEEP(15))--2025/02/28 07:29:28 0
Mr.1 *if(now()=sysdate(),sleep(15),0)2025/02/28 07:29:22 0
Mr.1 1-1) OR 715=(SELECT 715 FROM PG_SLEEP(15))--2025/02/28 07:29:11 0
Mr.1 -1" OR 2+333-333-1=0+0+0+1 -- 2025/02/28 07:29:07 0
Mr.1 -1' OR 2+617-617-1=0+0+0+1 or 'N1OQbQx6'='2025/02/28 07:29:05 0
Mr.1 -1' OR 2+490-490-1=0+0+0+1 -- 2025/02/28 07:29:04 0
Mr.1 -1 OR 2+787-787-1=0+0+0+12025/02/28 07:29:02 0
Mr.1 -1 OR 2+597-597-1=0+0+0+1 -- 2025/02/28 07:29:01 0
Mr.1 1-1 OR 239=(SELECT 239 FROM PG_SLEEP(15))--2025/02/28 07:28:54 0
Mr.1 NMPQHVqz2025/02/28 07:28:44 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