Hi, great library, thanks for sharing it with the community! I found a behavior that I think is a defect and I don't want to submit a pull request because some of this code is pretty complicated (to me!).
Use case:
Primary Key is a Guid, value set on application layer
Property for primary key has a private setter
Steps to Reproduce:
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid PasswordResetTokenId { get; private set; } // Value set in constructor
Insert operation:
Conn.Connection.Insert(token);
Expected Behavior:
Object will be inserted in database.
Actual Behavior:
Exception is thrown because you can't insert NULL value for PasswordResetTokenId into the database row.
Comments:
I believe this is a defect because since the database is not providing the value for the Key field (we indicate this with the [DatabaseGenerated(DatabaseGeneratedOption.None)] attribute, so FastDapper shouldn't need to assign a value to this property.
Impact:
In some cases, to use FastDapper we have to make private properties public if we want to use FastDapper
We recommend keeping the properties as public. These are data entities, they should not contain any kind of logic in them (including initialization logic).
Hi, great library, thanks for sharing it with the community! I found a behavior that I think is a defect and I don't want to submit a pull request because some of this code is pretty complicated (to me!).
Use case:
Steps to Reproduce: [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public Guid PasswordResetTokenId { get; private set; } // Value set in constructor
Insert operation: Conn.Connection.Insert(token);
Expected Behavior: Object will be inserted in database.
Actual Behavior: Exception is thrown because you can't insert NULL value for PasswordResetTokenId into the database row.
Comments:
Impact: