What's the difference between [Computed] and [Write(false)] attributes?

0 votes
asked Aug 27, 2019 by spiritbob

This resource explains how Computed excludes a property (in an update only?).

Specifie the property should be excluded from update.

[Table("Invoice")]
public class InvoiceContrib
{ [Key] public int InvoiceID { get; set; } public string Code { get; set; } public InvoiceKind Kind { get; set; } [Write(false)] [Computed] public string FakeProperty { get; set; }
}
using (var connection = My.ConnectionFactory())
{ connection.Open(); var invoices = connection.GetAll<InvoiceContrib>().ToList(); // The FakeProperty is skipped invoices.ForEach(x => x.FakeProperty += "z"); var isSuccess = connection.Update(invoices);
}

Doesn't Write(false) fulfill the same purpose though? What's the difference between [Computed] and [Write(false)]?

Edit:

I've just checked the resource linked in response to my question. It almost hits the nail on this! Could someone please confirm if both attributes perform the same operations, but are just worded in two different ways, as to give a better abstraction to their users?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...