Poco class doesn't populate Id property when fetched back.
Hi All,,
I've created a Poco class to store some information. The storeing process is all working fine, the data enters the database, get's a unique id value etc.
However,
When I come to recall the information, the Fetch process isn't populating the Id property on my class and I can't for the life of my see why.
This is my class:
[TableName("Announcement")]
[PrimaryKey("Id", autoIncrement = true)]
[ExplicitColumns]
public class Announcement : IAnnouncement
{
#region Implementation of IAnnouncement
[PrimaryKeyColumn(AutoIncrement = true)]
public int Id { get; set; }
[Column("NodeId")]
public int PageId { get; set; }
[Column("Title")]
public string Title { get; set; }
[Column("Message")]
public string Message { get; set; }
#endregion
}
This is my code for retrieving the announcements.
var sql = new Sql().Select("*").From<Announcement>(new SqlCeSyntaxProvider());
var announcements = DatabaseContext.Database.Fetch<Announcement>(sql);
Poco class doesn't populate Id property when fetched back.
Hi All,,
I've created a Poco class to store some information. The storeing process is all working fine, the data enters the database, get's a unique id value etc.
However,
When I come to recall the information, the Fetch process isn't populating the Id property on my class and I can't for the life of my see why.
This is my class:
This is my code for retrieving the announcements.
Any one got any ideas?
Found the issue! At long last!
Changing this line from this:
to this:
solved the issue.
is working on a reply...