Click here to Skip to main content
15,881,092 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.
I have a table in my project that fields inserted with c# encode before.
but in get mthods we don't handled decoding. some thing like this :

var submitPerson = (from i in db.tSubmitPersons
                                where i.SubmitPersonID == Convert.ToInt32(lblPersonID.Text)
                                select i);

txtOtherLanguages.Text = submitPerson.Single().otherLanguages;


And I have this codes in many pages several times.
Is there any way to decode these fields once some where like trigger?
I want to use decode method once and don't add it in all pages when I use this table if possible.
And I need these fields encoded in tables. no way to decode in sql.
Any idea?
Thanks in advance.
Posted
Comments
AmitGajjar 6-Apr-13 8:33am    
what encoding you have used ?
arminamini 6-Apr-13 8:40am    
Something like this :
<pre>
private string EncodeServerName(string ServerName)
{
byte[] NameEncodein = new byte[ServerName.Length];
NameEncodein = System.Text.Encoding.UTF8.GetBytes(ServerName);
string EcodedName = Convert.ToBase64String(NameEncodein);
return EcodedName;
}
</pre>

And I need something like triggers but in linq in c# not in sql side. That I run it before all gets methods in all project parts.
Thanks.
AmitGajjar 6-Apr-13 8:42am    
Create extension method that will decode your table information. but you need to apply method on all your query.
arminamini 6-Apr-13 8:45am    
aah Thanks. I hoped if exists some thing like trigger in linq!
AmitGajjar 6-Apr-13 8:48am    
can you explain what you mean by trigger in linq ? i never heard that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900