susacd wrote:
It may sound silly, but I do need to see the fields mapped onto 1:1 relation. For example, I have EntityPatient which contains EntityCity, and I cannot directly bind my controls to Patient.City.Name in VS.NET 2005 (WinForms project) as it complains that there is no City property for the Patient object (of course, it is visible from the code window). Instead of this simple and elegant approach, I now have to instantiate a separate City object as a datasource for a separate BindingSource object, or to perform similar tricks.
My questions are:
- can the code generator (or templates) be changed to remove "Browsable(false)" on 1:1 fields (objects)?
- what was the initial reason for attaching this attribute to 1:1 fields?
Denis
It's a pain. The 'datasource' item in vs.net works different from the .NET 1.x approach, currently the code doesn't have support for that.
ICustomTypeDescriptor doesn't work well with datasource/bindingsource, which is a bug in vs.net 2005 and which they're not willing to fix before the next vs.net version. So I had to remove ICustomTypeDescriptor.
The Browsable(false) property is there because it otherwise shows up in asp.net grids with automatic column retrieval (list of patients in a collection bound to a grid, you'll then get a city column). The ITypedList implementation on the entity collection will filter it out, otherwise it won't.
You don't give muchcontext information, which is really unfortunate, because we can't help you without it. Are you using Selfservicing or adapter? Is patient in a grid and are you binding the City.Name property to a textbox?
Because if you have a single patient object, you can also just bind the patient.city to the control, and set the datamember to 'Name'