Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore property on model property [closed]

Tags:

How can I ignore a property on my model using dapper/dapper extensions/dapper rainbow or any

of those dapper libraries?

like image 609
Elisabeth Avatar asked Oct 31 '13 21:10

Elisabeth


1 Answers

Dapper.Contrib has built-in support for marking a column as computed: add ComputedAttribute to allow support for computed columns on Insert. Here's how it works:

class MyModel {   public string Property1 { get; set; }    [Computed]   public int ComputedProperty { get; set; } } 

Properties marked with the Computed attribute will be ignored on inserts.

like image 91
Ben Collins Avatar answered Sep 19 '22 18:09

Ben Collins