Search This Blog
Thursday, September 7, 2017
How to implement the CreatedBy, CreatedOn and UpdatedBy, UpdatedOn properties in a business class
I would like to promote a KB article, which may be interesting for users who are just getting started with our application framework. This information is actually not new and it was already available in the FAQ and Reference sections of our online documentation as well as the support knowledge base.
I must emphasize that there are actually many ways to implement such auditing properties, and your current code may differ from what we show. For instance, one may declare it as "internal set {...}" or use the PersistentAlias attribute. Just do not be at all concerned.
You are welcome to share your own implementations in post comments - maybe we can vote for the most concise and beautiful code, eh?:-P
Subscribe to:
Post Comments (Atom)
An observation, it's probably better to use Nameof() in the SetPropertyValue calls.
ReplyDeleteAnother, if you're using the Persistent/PersistentAlias pattern, you should be aware of calling OnPropertyChanged otherwise you can run into issues when trying to use partial SQL updates, see comments in T513152.
Yet another observation... adding the audit information is useful, but does come with an unexpected performance penalty. You are adding loads more SQL SELECTs to populate the user classes. If there is fan-out from your user class to other tables, then this is added as well.
And finally, UpdatedOn is probably a good candidate field for an index if you're performing bulk updates / integrating with other systems.
Someone has also mentioned NonCloneable attribute in the topic.
Something else with considering is whether you should explicitly store dates as UTC and make use of [ValueConverter(typeof(UtcDateTimeConverter))] decoration.
We'll mention some of these optional additions in the source article. Thanks for sharing, Chris.
DeleteAksaray
ReplyDeleteAydın
Kütahya
Rize
Bingöl
Q3ZAS
Adana
ReplyDeleteElazığ
Kayseri
Şırnak
Antep
CL5
sakarya
ReplyDeleteyalova
elazığ
van
kilis
RVTVGK
van
ReplyDeletedüzce
mardin
elazığ
sakarya
M6LV
whatsapp görüntülü show
ReplyDeleteücretli.show
C3N
B34D0
ReplyDeleteAdana Lojistik
Antalya Lojistik
Kütahya Parça Eşya Taşıma
Sinop Lojistik
Ordu Evden Eve Nakliyat
519DE
ReplyDeleteGümüşhane Evden Eve Nakliyat
Uşak Lojistik
Pursaklar Boya Ustası
Adıyaman Evden Eve Nakliyat
Denizli Şehir İçi Nakliyat
Sivas Evden Eve Nakliyat
Ordu Evden Eve Nakliyat
Uşak Parça Eşya Taşıma
Bolu Evden Eve Nakliyat
DBA54
ReplyDeleteboldenone
Tekirdağ Boya Ustası
order winstrol stanozolol
order clenbuterol
order oxandrolone anavar
Bitcoin Nasıl Alınır
Sinop Evden Eve Nakliyat
Siirt Evden Eve Nakliyat
Ankara Evden Eve Nakliyat
6D4DC
ReplyDeleterastgele görüntülü sohbet uygulamaları
burdur kadınlarla görüntülü sohbet
muş telefonda kadınlarla sohbet
kastamonu bedava sohbet siteleri
karaman canlı sohbet
karabük rastgele sohbet uygulaması
kayseri görüntülü sohbet yabancı
sinop canlı sohbet siteleri
malatya en iyi sesli sohbet uygulamaları
رقم المجاري بالاحساء RU9oDljsio
ReplyDelete