I have a few bool fields which require input from certain roles. I changed them to use the checkstate enum from the System.Windows.Forms namespace to allow me to initialize them to indeterminate for databinding, authorization and rule checking. It seems inappropriate (bloated) to add a reference of that type to a CSLA BO class.
So do I recreate it or just reference it (thus guaranteeing compatibility with form objects) and not worry?
_E
Thanks, ajj3085 (Andy?). I tried to open the source to look, but I only moved the assemblies to this machine. D'oh! It didn't seem to be a problem, so I thought I'd reenforce my claim to the crown as King of Stupid Questions. My boss loves to needle me on best practice questions.
Just downloaded the 1.53 zip again. :-]
_E
You want to try to avoid using the System.Windows.Forms namespace in your business layer. It typically means that your UI logic is creeping into you business layer. Your business layer should be completely independent of any UI.
pelinville:Is there a reason you couldn't just create a Enum in the CSLA namespace that has the values you need?Basically, it already exists (reinventing the wheel argument), and as noted, the namespace is insignificant to size the assemblies. I did create the enum in my library, but I needed to ensure it would match what is expected for databinding on forms, so I'd using the same namespace meets the requirement. When researching the definition, I found a mix of order for it, so getting just the right one was problematic without using it.
Now if this were going web, I'd rethink it more, but it's not.
_E
pelinville:You could even make a smartBool class to make handling this stuff even easier.
Copyright (c) Marimer LLC