Given the following table in my database (PostgreSQL)
CREATE TABLE produkt ( id SERIAL NOT NULL, name VARCHAR(50), created_at TIMESTAMP WITHOUT TIME ZONE DEFAULT timezone('utc'::text, now()) ); ALTER TABLE produkt ADD CONSTRAINT produkt_pkey PRIMARY KEY (id);
I want to use NPoco to access data using this poco
[TableName("produkt"), PrimaryKey("id", AutoIncrement = true)] public class Product { [Column("id")] public int Id { get; set; } [Column("name")] public string Name { get; set; } [Column("created_at")] public DateTime CreatedAt { get; set; } }
Now when i call
var product = new Product { Name = "My new Product" }; Database.Insert(product);
created_at -column -infinity , even if default declared. Is there any way to fix this? One option would be to set Date in the application, but I would prefer that this functionality be implemented using the default value in the database.
source share