Back to list
Views:   0
Replies:  0
Archived

,
Reply 1
I'm not responding to the first part of your question about why they didn't use the audit columns because I don't know why they didn't use them, but I will respond to your last question on including them into the class definition.

Yes, the audit properties should be in the class definition, but not directly.  Instead create a base class that all business object inherit that contains these common properties.  It's easier to maintain and works the same.

Next DON'T populate the property the way you have shown by have a data context query!  I would either follow their example and have the CreatedBy and ChangedBy properties be integers for the modifying users Id, or a string and enter their username.  No need to actually put in their name.  If you need the users real name for display purposes, create another property for it and simply populate it as you would any other property on the class.  Never have any type of data access query inside the property.  It's not flexible and breaks the Single Responsibility Principle (SRP).

I hope this helps.
King Wilder, Jul 09, 2014


Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas