views:

29

answers:

2

Hello,

I'm using Subsonic (SimpleRepository) in my new project and enjoy using it but...

With one, and only one of my table, it does not create all the columns and i don't understand why.

Here is the code :

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; }
}

Called like my other classes :

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

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

The table Ratings created contains the columns : ID, Comment, isValidate

Whatever what I try to add as default value, the 3 columns contains the value : ID = 1 (2, 3, 4...) -> works Comment = "" isValidate = false


As i noticed a probleme where naming a column "Read", i tryed to rename the columns, rename the table (which was "Vote" [in french]) but the probleme is the same as with my original table "Votes"

Could you help me please.

Thanks in advance (and sorry for my english)

+1  A: 

The only properties you're defining in that class are ID, Comment and isValidate so these are the only columns SubSonic will generate. Change your fields to properties and SubSonic should create columns for them:

[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; }
Adam
A: 

Thank you... Sorry for being so stupid today!