未创建列
我在我的新项目中使用 Subsonic (SimpleRepository) 并喜欢使用它,但是......
只有一张表,它不会创建所有列,我不明白为什么。
这是代码:
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、Comment、isValidate
无论我尝试添加什么作为默认值,这 3 列都包含该值: ID = 1 (2, 3, 4...) ->作品 评论=“” isValidate = false
当我注意到将列命名为“Read”时出现问题,我尝试重命名列,重命名表(即“Vote”[法语]),但问题与我的原始表“Votes”相同“
你能帮我一下吗?
预先感谢(抱歉我的英语)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在该类中定义的唯一属性是 ID、Comment 和 isValidate,因此这些是 SubSonic 将生成的唯一列。将字段更改为属性,SubSonic 应该为它们创建列:
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: