score:6
you could add a partial class with a property encapsulating this logic like:
public partial class dbtableitem
{
public string unencryptedpass
{
get
{
return crypter.decrypt(this.pass);
}
set
{
this.pass = crypter.encrypt(value)
}
}
}
hope it helps : )
score:4
you could define a fake password
property which encapsulates your password logic and an original password field (which is mapped to the database - passwordinternal
in my example) should be e.g. internal
.
public partial class yourentity
{
public string password
{
get
{
return crypter.decrypt(this.passwordinternal)
}
set
{
this.passwordinternal = crypter.encrypt(value)
}
}
}
afaik, there is no built-in functionality you're looking for.
score:4
you should use sql server cryptographic functions, encryptbykey and decryptbykey. even better still, use transparent database encryption. right now you encrypt and decrypt the password with some key stored who know where. databases have this nasty habit of moving around and being restored on completely new machines in case of disaster recovery or as part of various high availability scenarios, and you'll discover that storing the encrypted data in the database and the encryption key in the system key store (or worse, in the app) has left you with a bunch of 'completely secure' data, impossible to decrypt because you lost the key.
Source: stackoverflow.com
Related Query
- Encrypt column data with LINQ
- Linq to sql as object data source - designer problem with partial classes
- How to swap the data source associated with a Linq query?
- Linq Data Source WhereParameters with "\" in value
- c# linq query aggregation data with other column value
- How to get a column value from data table with Linq
- How I get the right Data from my Column with Linq
- c# Linq or code to extract groups from a single list of source data
- Querying external data source with LINQ
- Get data of multiple column with same foreign key in C# LINQ
- Convert CollectionBase to List or data type usable with Linq
- Select single column from dataset with LINQ
- find non intersecting data set with linq
- How to search Hierarchical Data with Linq
- Duplicate Rows when Data Binding with LINQ to Entities
- Stored Procedure return values with linq data context
- How To Create Generic Data Access Object (DAO) CRUD Methods with LINQ to SQL
- LINQ to SQL entity column name attribute ignored with guid primary key
- LINQ to SQL - Compile error when extending data context with partial class and methods
- Get excel cell value with Row and Column Position through open xml sdk linq query
- LINQ to SQL: Complicated query with aggregate data for a report from multiple tables for an ordering system
- LINQ method How to SelectMany with additional column from Parent class
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- LinQ query with multiple tables and extracting data
- How to get depth of hierarchical data with linq query?
- Select all rows with distinct column value using LINQ
- Linq to SQL: Where clause comparing a Nullable<DateTime> with a SQL datetime null column
- LINQ left join with only the row having maximum value of a column
- How does linq actually execute the code to retrieve data from the data source?
- Pivot data in two nested List<T> with Linq
More Query from same tag
- Is it faster to use LINQ to get a row from a List or a foreach loop
- EF Core (LINQ) - The Query expression could not be Translated
- LINQ Query not returning actual values
- How to do the following in LINQ
- Shortest way to merge DataTables and remove all duplicate rows
- Read first row of excel sheet using OpenXML and LINQ
- Custom jQuery Selector That Returns Selected Element Properties Like LINQ
- Maximum Date of record with LINQ
- MySQL query to linq
- Remove sub IEnumerable from IEnumerable
- Why does my dynamic IEqualityComparer not work?
- Linq: filter Ids from a list of class
- Recode Datatable Column with Linq
- Linq Date Performance Death
- Can a LINQ Expression defined as a lambda expression include other LINQ Expressions?
- How to find the keys in dictionary object which matches partially?
- Parse style attribute collection using linq
- C# Query MongoDb using linq and returning valid Json
- C# Pass entity property to a function to use in LINQ
- Converting object returned from Linq.Dynamic
- MongoDB: retrieve, filter and sort MongoDB embedded collections
- LINQ get the average of columns and write to csv
- Update list items based on months in C#
- DefaultIfEmpty behavior specifics
- Calling a function within a Linq query
- How to reset the identity column in C#?
- how to find correct model item from list
- Checking if Var from LINQ query is Null and returning values older than x
- ASP.NET MVC TDD with LINQ and SQL database
- Split string at specific character but ignore some cases C# LINQ