I love the idea of using those simple-looking attributes from System.ComponentModel.DataAnnotations that Rocky describes starting at about 19:45 into the Business and Validations Rules video in the core series (Core3805).
I'm trying to use them in VS2008 VB.NET without any success. The namespace doesn't even seem to exist here. I've double checked my compiled advanced options and my solution is definitely using .NET 3.5.
So why can't I find this class in the Framework?
Thanks in advance.
You need to add a reference to your project to the System.CompontentModel.DataAnnotations.dll first and then it will become available.
Don't worry, I too thought I was going crazy before I found it!
Thanks - that did it, of course.
Can I ask another question about them?
My application requirement is just to read some data from the database and report things wrong with it that have to be fixed outside of my system. So I can really live with a ReadOnly object to fetch the data. But can I use Validation Rules functionality with a ReadOnly Object?
I don't care about IsSaveable or any of that... all I need to know is IsValid and to be able to display the BrokenRules.
And I'm guessing I'll need to do an Editable List of some type... but it would be nice to do ReadOnly.. so can it?
You would need to use an editable object to get the validation rules (and therefore broken rules), which I've had to do several times.
However ,you can then just make all the properties read-only so you don't have to worry about users being able to make changes.
Yeah, that's what I thought. I really should have just found that in the book instead of asking here but, heck, I was lazy and I was here already <g>.
Thanks for the reply. I'll try and limit the noise in the future. Hope the rest of your week is a fine one.
Copyright (c) Marimer LLC