I have developed MyGeneration modules to create CSLA objects and SQL Stored Procedures. As part of my implementation I have included code so that the objects are totally accessible from a Property Grid. I have included Lazy Loading of related data, and all of this works as expected, no small thanks to Rocky!
I am now at the point where I would like to integrate security. I would like the PropertyGrid to show the CSLA security though CanWriteProperty. To do this, I was planning to use ICustomTypeDescriptor to specify a ReadOnly attribute.
I was able to add the ICustomTypeDesciptor and it did what I wanted to the PropertyGrid. However, when I try to use data binding, the object no longer appears in my list of data binding sources. If I comment out the ",ICustomTypeDesciptor" interface declaration (not any of the supporting code, simply the declaration) the object is accessible from the data binding sources.
I realize this is not an issue with CSLA, but, I was hoping that someone might have an idea how to make fields in a propertygrid read-only based upon CanWriteProperty.
Just after I posted this yesterday, I found this item on Microsoft that explains why.
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=93944
However, I am working on a solution. It involves creating a CustomTypeDescriptor that encloses the class that I want to use. Then when I want to use it in a property grid I will use th e CustomTypeDescriptor. When I want to use DataBinding I simply point to the object itself. I have a test version working, but, I will post a full version when I get it tested.
Copyright (c) Marimer LLC