Click here to Skip to main content
15,885,546 members
Home / Discussions / C#
   

C#

 
AnswerRe: COM Interoperability Pin
Christian Graus4-Oct-07 19:38
protectorChristian Graus4-Oct-07 19:38 
GeneralRe: COM Interoperability Pin
KrunalC4-Oct-07 19:44
KrunalC4-Oct-07 19:44 
GeneralRe: COM Interoperability Pin
Christian Graus4-Oct-07 19:53
protectorChristian Graus4-Oct-07 19:53 
GeneralRe: COM Interoperability Pin
KrunalC4-Oct-07 20:09
KrunalC4-Oct-07 20:09 
GeneralRe: COM Interoperability Pin
Christian Graus4-Oct-07 20:41
protectorChristian Graus4-Oct-07 20:41 
GeneralRe: COM Interoperability Pin
KrunalC4-Oct-07 20:48
KrunalC4-Oct-07 20:48 
Questionpicking data(row) from database with cycling form Pin
syibu4-Oct-07 18:16
syibu4-Oct-07 18:16 
QuestionExtending xsd.exe generated classes Pin
Rafferty Uy4-Oct-07 17:59
Rafferty Uy4-Oct-07 17:59 
Hello,

I'm having a problem Serializing/Writing the objects that were initially generated by xsd.exe and then extended (by adding attributes) via partial class. Since it will be hard to read if I paste all my code, I'll try to explain it instead.

XSD generates classes from the schema. IN my case let's call them:
public partial class ParentClass {}<br />
public partial class ChildClass {}


All of these are generated inside a DataModel.cs class.
So I created another DataModelEx.cs class where I added the following:

public partial class ParentClass<br />
{<br />
   private string dataRootField = string.Empty;<br />
<br />
   public string DataRoot<br />
   {<br />
     get { return dataRootField; }<br />
     set { dataRootField = value; }<br />
   }<br />
}<br />
<br />
public partial class ChildClass1<br />
{ private ParentClass parent = null; }



Adding these, when I try put values in the class and serialize it, this is the error that I am getting:
Error: There was an error reflecting type 'NAVITAIRE.SkyPlan.utility.data.DirectorySettings'.<br />
   at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, XmlAttributes a, Boolean repeats, Boolean openModel)<br />
   at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel model, XmlRootAttribute root, String defaultNamespace)<br />
   at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type, XmlRootAttribute root, String defaultNamespace)<br />
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)<br />
   at System.Xml.Serialization.XmlSerializer..ctor(Type type)<br />
   at NAVITAIRE.SkyPlan.utility.Util.WriteDataToXml(String outputFile, Object data) in C:\workspace\PlanningSuite_Local_Dev\gui\src\utility\Util.cs:line 1741



My guess is that I may be missing some tags like the following in declaring my attributes:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]<br />
[System.SerializableAttribute()]<br />
[System.Diagnostics.DebuggerStepThroughAttribute()]<br />
[System.ComponentModel.DesignerCategoryAttribute("code")]<br />
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]<br />
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]


I am not familiar about these [] tags before declarations, so please help me out. I tried experimenting by placing some [System.Xml.Serialization.XmlIgnore()] before the new properties but it didn't seem to work, or maybe I just placed them incorrectly.


Thank you for your help!

Sincerely,

Rafferty
AnswerRe: Extending xsd.exe generated classes Pin
Rob Philpott4-Oct-07 22:58
Rob Philpott4-Oct-07 22:58 
GeneralRe: Extending xsd.exe generated classes Pin
Rafferty Uy10-Oct-07 23:58
Rafferty Uy10-Oct-07 23:58 
QuestionClickOnce - How to get the list of modules that need to be updated Pin
Michael Sync4-Oct-07 17:14
Michael Sync4-Oct-07 17:14 
Questionplz hepl me to validate date on datagrid template. .....Y no one to help? Pin
P_Elza4-Oct-07 16:52
P_Elza4-Oct-07 16:52 
QuestionCustom Tooltips in C# Pin
Astro the Space Duck4-Oct-07 15:51
Astro the Space Duck4-Oct-07 15:51 
AnswerRe: Custom Tooltips in C# Pin
PIEBALDconsult4-Oct-07 16:22
mvePIEBALDconsult4-Oct-07 16:22 
GeneralRe: Custom Tooltips in C# Pin
Astro the Space Duck4-Oct-07 17:39
Astro the Space Duck4-Oct-07 17:39 
AnswerRe: Custom Tooltips in C# Pin
Scott Dorman4-Oct-07 16:52
professionalScott Dorman4-Oct-07 16:52 
GeneralRe: Custom Tooltips in C# Pin
Astro the Space Duck4-Oct-07 17:40
Astro the Space Duck4-Oct-07 17:40 
AnswerRe: Custom Tooltips in C# Pin
Astro the Space Duck5-Oct-07 6:24
Astro the Space Duck5-Oct-07 6:24 
GeneralRe: Custom Tooltips in C# Pin
Astro the Space Duck5-Oct-07 7:06
Astro the Space Duck5-Oct-07 7:06 
QuestionTextbox C# Pin
OlieColie4-Oct-07 13:47
OlieColie4-Oct-07 13:47 
AnswerRe: Textbox C# Pin
Colin Angus Mackay4-Oct-07 14:06
Colin Angus Mackay4-Oct-07 14:06 
AnswerRe: Textbox C# Pin
Christian Graus4-Oct-07 14:37
protectorChristian Graus4-Oct-07 14:37 
AnswerRe: Textbox C# Pin
Anthony Mushrow4-Oct-07 14:52
professionalAnthony Mushrow4-Oct-07 14:52 
GeneralRe: Textbox C# Pin
PIEBALDconsult4-Oct-07 15:14
mvePIEBALDconsult4-Oct-07 15:14 
AnswerRe: Textbox C# Pin
Malcolm Smart4-Oct-07 20:53
Malcolm Smart4-Oct-07 20:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.