henkmollema / Dapper-FluentMap

Provides a simple API to fluently map POCO properties to database columns when using Dapper.
MIT License
427 stars 86 forks source link

ReadOnly Fields #94

Closed azilberbaum closed 4 years ago

azilberbaum commented 5 years ago

Would love to have a ReadOnly property like there is for Ignore

henkmollema commented 5 years ago

I don't think I understand. What are you trying to achieve?

azilberbaum commented 5 years ago

Basically I want to add a field I can populate in my model via a query but not have it try to save to the database.

Example could be a computed field, or a count field.

If I use ignore it won’t populate, so really need read only property.

This would be huge for me!

Sent from my iPhone

On Jul 27, 2019, at 5:04 AM, Henk Mollema notifications@github.com wrote:

I don't think I understand. What are you trying to achieve?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

StefanJanssen95 commented 4 years ago

If I understand the feature suggestion correctly another use would be for a Created field. It will get a default value from the database when inserting and you don't want to keep supplying it for every update.

TroySchmidt commented 4 years ago

@azilberbaum I have been able to accomplish this with public get and private set on the accessibility of the model property. The behavior I experience is the property is populated on the selects and ignored on the insert and updates. (i.e. computed fields)

henkmollema commented 4 years ago

Not sure what to do here. Please re-open if you have an example of desired behavior (or a PR! :-))