I built a Class Library in which I included an XML Schema. It has a single element called "tblPatient" with a bunch of attributes. The XML Schema is called dsPatient.
If I declare a variable of type dsPatient, I get all of the attributes like properties of the tblPatient table like this:
... and so forth.
But when I include a reference of this Class Library in a Windows application and declare a variable of type dsPatient, I can get the "tblPatient" as a property, but all of the "Column Properties" are gone. Since this is a typed dataset, I would expect to see those columns as properties but they are gone. Why is this happening? How can I correct this? Thank you very much in advance for your help.
First, you're not including an XML Schema but a DataSet schema. Those are different things. The former does not generate any code (i.e. the typed dataset class).
Second, keep in mind that when you write the following code dsTest.tblPatient.PatientIDColumn, you're accessing the column definition data, but not any row data. When you access a row, you will get the typed properties using dsTest.tblPatient.PatientID.
As far as accessing the column definition data itself, it's automatically generated with internal visibility, that's why you don't see it from outside the project. Select Project -> Show All Files, and expand the dataset schema. You will see two files below it -- one of them is the automatically generated class. Look for the corresponding table and you'll see it. I don't know why this isn't an option we can choose, but it's certainly an inconvenience you'll have to live with for now.
Dig Deeper on Win Development Resources
Related Q&A from Daniel Cazzulino
Here Daniel Cazzulino explains how to load a DSL (domain specific language) domain model instance file programmatically. This requires the .NET type ... Continue Reading
Here we offer a glimpse at 12 of .NET development expert Danny Cazzulino's top ASP.NET questions and answers. Continue Reading
C# developers should NOT be modifying InitializeComponent method in the code-behind (or any of the variable definitions) by hand. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.