Closed ruant closed 4 years ago
[TableName(OrderSql.TableName)]
[PrimaryKey(OrderSql.Id, AutoIncrement = false)]
[ExplicitColumns]
public class Order : DatabaseModelBase
{
[Column(OrderSql.Id)]
public Guid Id { get; set; }
[ResultColumn(OrderSql.OrderIdRef)]
public int OrderIdRef { get; set; }
[Column(OrderSql.MemberId)]
public Guid MemberId { get; set; }
}
Try using [ResultColumn]
on that one so it only gets populated but not updated.
Of course! Why didn't I think of that attribute.
Works like a charm.
Cheers @schotime 🥂
I ended up using [ComputedColumn] since I want the SQL query being built to include the field in the SELECT.
I'm having problems to get this to work.
The
Id
field is the PrimaryKey and is Guid. TheOrderIdRef
is set to auto increment in the database.But I'm getting the following error:
Cannot insert explicit value for identity column in table 'Order' when IDENTITY_INSERT is set to OFF.