Out of curiosity, are you using any of the various Smart* classes available in the CslaContrib project?
(SmartInt16, SmartInt32, SmartInt64, SmartDecimal, SmartFloat, SmartBool, etc.)
If not, why not?
At the risk of extending the thread....what are the main benefits of using them?
triplea:Well pretty much the same reason you use SmartDate (if you do), which is a way of dealing with primitive types (e.g. int, bool etc) effectively on both the UI and database level. So e.g. you have a property called Age which can be null. SmartInt32 allows you to display the corresponding textbox as being empty on the UI plus store null when the time comes to update your database. There is more to it but that's my main use. Using nullable types (e.g. int? ) doesn't work very well.
The other benefit of the smart* classes is that they understand that an "empty" variable means different things in different contexts. Let's take an object that has an EffectiveDate and an ObsoleteDate property in it.
Exactly what does an empty ObsoleteDate mean? An empty date could mean the same as a database NULL, i.e., "I don't know what the ObsoleteDate is." Or, an empty ObsoleteDate could mean "This object is valid and remains so until the end of time (at least until I change the ObsoleteDate to some other value)." Ditto for the EffectiveDate, except in a different time direction.
The SmartClasses understand that concept and make it very easy to implement.
dmccrory:At the risk of extending the thread....what are the main benefits of using them?
Hope the preceding message answered why the other Smart* classes are handy to use.
Another contributor put in an ObjectListView class which is really easy to use. It provides a sorted and filtered view of a business object collection that binds to front-end controls very nicely.
I use the ObjectListView all over the place. It is very well written.
It handles multi-property sorting which is extremely useful in some situations.
Filtering is very easy too.
I wrote a couple of Helper methods to make it easy to fetch one of these from all of my web pages.
Highly recommended.
Joe
Copyright (c) Marimer LLC