WriteOnly field

Posts   
 
    
Chaos
User
Posts: 33
Joined: 13-Jul-2006
# Posted on: 12-May-2008 15:36:38   

Erm, Hi guys, I don't know even how to begin to think how to ask my question ;/

LLBLGenPro - 2.5 Final, Build - March 28th, 2008

Context - Windows XP SP3, Visual Studio 2008, .NET 3.5 framework, SQL Server 2005, Adapter specific.

Here is it then - I need to store some field which is an encrypted password. I want only to post it (insert it) and not to be able to read it. So I don't want to fetch this one, but I want to be able to write it.

The thing is I want just to transport the data, encrypt it (on server side) and commit it. And never to fetch it back. (At least not through the entity mechanism) The other fields though should be fetchable.

Is there any different way than custom update query? And to use a dll and the SQL Server to encrypt the field on trigger?

Cheers. ** And keep on the good work.**

Posts: 1263
Joined: 10-Mar-2006
# Posted on: 12-May-2008 19:57:37   

1) Unless you use Include/Exclude fields on every fetch, it is going to come into the entity every time.

2) If it is encrypted, when it is fetched, it will remain encrypted - so reading it would show the encrypted data.

3) If you want, you can write a custom type converter (which is easy) that will encrypt the data for you - so the encryption does not have to take place in the trigger. You can also write the custom type converter in such a way that when the value is READ back by your code, it simply returns an empty string. This would give the appearance to the developer that the field is never fetched - although it is fetched, just your type converter shows it as 'blank'.

4) Finally, using the LLBLGen GUI, you could have your 'normal entity' such that it does NOT include this encrypted field - this way it will never be fetched. Then create another special 'insertentity' that includes only that field and the pkey....you would then use that entity to do the insert/update of the encrypted field. Of course, using this special entity would cause that field to be fetched....

That's all I have for you.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-May-2008 04:55:32   

For what you are trying to achieve I would go on the Option 1 posted by Wayne.

David Elizondo | LLBLGen Support Team
Chaos
User
Posts: 33
Joined: 13-Jul-2006
# Posted on: 13-May-2008 14:12:49   

10x Wayne, and you daelmo. This was helpful.

Cheers.