Request a topic or
contact an Arke consultant
404-812-3123
All posts tagged 'credit cards'

Arke Systems Blog

Useful technical and business information straight from Arke.

About the author

Author Name is someone.
E-mail me Send mail

Recent comments

Archive

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Extending LINQ to SQL

We have been experimenting with LINQ to SQL on a couple projects lately and I am constantly impressed.  I'll post some tidbits as I come across some neat features.

Today I had to display the last 4 digits of a customer's credit card number on the UI.  I already have a DBML file in my project and the Customer table has been added to the designer.  Customer has a CreditCardNumber property (ignoring encryption for purposes of this example).  Of course business logic layers aren't new but all too often, you would find logic in the UI that displays the right 4-digits.  But now implementing the BLL is even easier by simply implementing a partial class.

Partial Public Class Customer
    Public Readonly Property Last4 as String
        Get
            Return Right(Me.CreditCardNumber, 4)
        End Get
    End Property
End Class

You can take it one step further and override the CreditCardNumber property and change the Get to return ************XXXX instead of the clear text credit card number, which will make your business logic even more secure.


Posted by Eric Stoll on Wednesday, January 2, 2008 1:40 PM
Permalink | Comments (0) | Post RSSRSS comment feed