This project is read-only.

Check invalide DependencyName

May 15, 2010 at 12:13 AM
Hi, 

Thanks for the great the ViewModelBase! It is exactly what I want.

my suggestion: Check if the DependencyName is valid or not in debug mode.

Thanks.

 

May 19, 2010 at 8:05 PM
zunyite, Thanks for the suggestion. It is a good one. However, I am not sure how to handle dynamic properties. For instance, if I depend upon a dynamic property named "MyDynamicFoo" and it hasn't been set by anyone yet, what should I do in that case? Brian
May 19, 2010 at 10:20 PM
IMHO, 

add a parameter to the attribute to
DependsUpon("propertyname", checkname=true)
and a attribute
DependsUponFoo("propertyname")
always check name

Thanks

May 20, 2010 at 2:47 PM
Great feedback. I will incorporate it when I get the chance. Right now, I am working on getting ViewModel creation via custom resolvers. In the mean time, if you want to submit a patch, I will be more than happy to incorporate it. Brian
Jun 5, 2010 at 4:52 AM

zunyite,

I have implemented this feature for you.  Here is how you use it:

[DependsUpon("InputA", VerifyStaticExistence = true)]

It will throw an ArgumentException if InputA does not exist.  I do it at DEBUG and RELEASE.  I don't like to have exceptions that only fire during DEBUG.
Hope it helps :)
B

Jun 5, 2010 at 6:00 PM

Thanks.