Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Required but allow Zero
Message
From
19/10/2010 08:59:42
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
19/10/2010 08:40:17
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01485947
Message ID:
01486102
Views:
49
>>Frank, it is generated in the business layer because you checked the "required" on the field. You are free to modify that method as you see fit and that should not be a problem. If you want to move it to your partial class then it wouldn't be overwritten if you re-run the generator. (something I very rarely do).
>
>Yes, Tim, I understand that, it was actually checked automatically by the generator since the field does not allow nulls, but why is 0 not considered a valid value? I thought required was a check for NOT NULL.
>
>Does the conversion from tinyint to byte sound correct to you?
>
>I am afraid that I regularly rerun the generator and like the use of the partial classes. I'm just not comfortable adding in a new field to a table and then manually adjusting the code in the BO to handle it. The couple times I tried it I missed something and messed things up pretty spectacularly.

Hi Frank,

I have the opposite problem. When I generate business objects, entities, defaults, and rules the first time I spend more time making sure the settings are as I need them to be. If I then go back in later and re-run the generator, I inevitably set something a bit different than before and break something. At any case you can move the rule to your partial class and it won't be over written if you re-run the generator.

I would suppose the conversion from tiny Int to byte is correct and I didn't mean to cause concern over that. I just had not given that thought. As far as a zero value, yes, some of the checks are not as expected depending on what the data type is. Which is why the code is exposed for you to modify it as needed so easily. I am not sure I have an answer for the rationale behind what is or isn't valid for a tiny int or byte value. I seem to remember some discussion about that once before but probably couldn't find it again.

I would recommend that you chalk that up to something you know about the framework and then move that rule into your partial class to preserve it. Then modify it to check for empty string and return a message that works for you if it is broken. If you are curious to know more about it, I can see what I can learn.
Thanks Frank
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform