0

私は新しいプロジェクトで Subsonic (SimpleRepository) を使用しており、それを楽しんでいますが...

私のテーブルの1つだけでは、すべての列が作成されず、その理由がわかりません。

コードは次のとおりです。

public class Rating
{
    public Rating()
    {
        UsernameVotant = "";
        UsernameEvaluate = "";
        Note = 0.0;
        NoteAccueil = 0.0;
        NotePedagogie = 0.0;
        NoteRapportQP = 0.0;
        NoteContenu = 0.0;
        Comment = "";
        stageId = 0;
        DateNote = DateTime.Now;
        isValidate = false;
    }
    [SubSonicPrimaryKey]
    public int ID { get; set; }
    public DateTime DateNote;
    public int stageId;
    public string UsernameVotant;
    public string UsernameEvaluate;
    public int Note;
    public int NoteAccueil;
    public double NotePedagogie;
    public double NoteRapportQP;
    public double NoteContenu;
    [SubSonicLongString]
    public string Comment { get; set; } 
    public bool isValidate { get; set; }
}

私の他のクラスのように呼び出されます:

IRepository _repoRun = new SimpleRepository(Core.Config.ArticlesDB, SimpleRepositoryOptions.RunMigrations);

   public bool AddRating(Rating p)
    {
        _repoRun.Add<Rating>(p);
        return true;
    }

作成された評価テーブルには、ID、コメント、isValidate の列が含まれています。

デフォルト値として何を追加しようとしても、3 つの列には値が含まれます: ID = 1 (2, 3, 4...) -> 動作 コメント = "" isValidate = false


列に「読み取り」という名前を付ける問題に気付いたので、列の名前を変更し、テーブルの名前を変更しようとしましたが(フランス語では「投票」でした)、問題は元のテーブル「投票」と同じです

私を手伝ってくれますか。

事前に感謝します(そして私の英語で申し訳ありません)

4

1 に答える 1

2

そのクラスで定義している唯一のプロパティは ID、Comment、および isValidate であるため、これらは SubSonic が生成する唯一の列です。フィールドをプロパティに変更すると、SubSonic はそれらの列を作成します。

[SubSonicPrimaryKey]
public int ID { get; set; }
public DateTime DateNote { get; set; }
public int StageId { get; set; }
public string UsernameVotant { get; set; }
public string UsernameEvaluate { get; set; }
public int Note { get; set; }
public int NoteAccueil { get; set; }
public double NotePedagogie { get; set; }
public double NoteRapportQP { get; set; }
public double NoteContenu { get; set; }
[SubSonicLongString]
public string Comment { get; set; } 
public bool IsValidate { get; set; }
于 2010-01-07T11:49:18.733 に答える