简体   繁体   English

未创建的列

[英]Columns not created

I'm using Subsonic (SimpleRepository) in my new project and enjoy using it but... 我在新项目中使用Subsonic(SimpleRepository),喜欢使用它,但是...

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); IRepository _repoRun =新的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 创建的表Ratings包含以下列: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 无论我尝试添加什么作为默认值,3列均包含以下值: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" 正如我注意到命名列“ Read”的问题一样,我试图重命名列,重命名表(“ Vote”(法语)),但问题与原始表“ Votes”相同

Could you help me please. 请问你能帮帮我吗。

Thanks in advance (and sorry for my english) 在此先感谢(对不起我的英语)

The only properties you're defining in that class are ID, Comment and isValidate so these are the only columns SubSonic will generate. 您在该类中定义的唯一属性是ID,Comment和isValidate,因此这些是SubSonic生成的唯一列。 Change your fields to properties and SubSonic should create columns for them: 将您的字段更改为属性,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; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM