ColumnAttribute.Storage property does not work as expected
See original GitHub issue public class EncryptedString
{
private string _str= "Encrypted";
[Column(Storage = "_str")]
public string Str { get { return "Decrypted"; } set { _str = "Encrypted"; } }
}
The idea here is to save encrypted string to DB and decrypt it when using inside the code. Bit it does not work
db.Insert(new EncryptedString());
inserts “Decrypted”, so storage is not used.
Also, when I query
db.Strings.Where(g => g.Str == "Decrypted")
It queries on “Decrypted” string, not “Encrypted”
Is it a bug? If not, how do I make it work?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Linq data mapping: usage of Storage property on column ...
With "a" I would expect this to fail, as it doesn't really know about the property ParentId (only the field m_parentid and the...
Read more >Attribute-Based Mapping - ADO.NET
AssociationAttribute and ColumnAttribute Storage property values are case sensitive. For example, ensure that values used in the attribute ...
Read more >Reference: Storage (Magic xpa 4.x)
If set to No, the column will be mapped according to the column's Storage property. The Default Storage property is also available for...
Read more >Optimize NULL values storage consumption using SQL ...
SQL Server 2008 introduces a new column attribute that is used to reduce the storage consumed by NULL values in the database tables....
Read more >Data Bound Columns - Telerik UI for Blazor
The grid skips fields marked with the IgnoreDataMemberAttribute when performing CUD operations. Its presence indicates that this property does not need to be ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
What about:
this should work
Speaking about your suggestion, i think yes we should implement also read usage for storage.
Working on value converters, similar to HasConversion in EF Core. I hope will finish today.