473,804 Members | 3,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization Problem - Please Help!

Hi group, i'm getting the following excepction while trying to
serialize a class:

Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.

The code for the class in question (and it's superclass) is the
following:

public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}

private EntityTypes _type;

public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}

private EntityTypes _type;

public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}

I've tried setting different names for each class but it didn't help

Any help would be greatly appreciated.

Gonzalo

Feb 15 '07 #1
8 1643
Gonza,

The problem is that both your base class and the class inheriting from it
have the same property name. You can specify with an attribute a different
name to use like this:

[XmlElement("Ent ityTypeCollecti on")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}

Shaun McDonnell
"Gonza" <go******@gmail .comwrote in message
news:11******** **************@ h3g2000cwc.goog legroups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:

Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.

The code for the class in question (and it's superclass) is the
following:

public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}

private EntityTypes _type;

public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}

private EntityTypes _type;

public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}

I've tried setting different names for each class but it didn't help

Any help would be greatly appreciated.

Gonzalo
Feb 15 '07 #2
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Gonza,

The problem is that both your base class and the class inheriting from it
have the same property name. You can specify with an attribute a different
name to use like this:

[XmlElement("Ent ityTypeCollecti on")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}

}

Shaun McDonnell

"Gonza" <gonza...@gmail .comwrote in message

news:11******** **************@ h3g2000cwc.goog legroups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.
The code for the class in question (and it's superclass) is the
following:
public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}
private EntityTypes _type;
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
I've tried setting different names for each class but it didn't help
Any help would be greatly appreciated.
Gonzalo- Ocultar texto de la cita -

- Mostrar texto de la cita -
Thanks for your help shaun, but that doesn't seem to work. Any other
ideas?

Feb 15 '07 #3
Gonza,

Try giving the classes different names using the XmlElement attribute.

--
Shaun McDonnell
..NET Software Architect
407.902.8238

"Gonza" <go******@gmail .comwrote in message
news:11******** *************@p 10g2000cwp.goog legroups.com...
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
>Gonza,

The problem is that both your base class and the class inheriting from it
have the same property name. You can specify with an attribute a
different
name to use like this:

[XmlElement("Ent ityTypeCollecti on")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}

}

Shaun McDonnell

"Gonza" <gonza...@gmail .comwrote in message

news:11******* *************** @h3g2000cwc.goo glegroups.com.. .
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.
The code for the class in question (and it's superclass) is the
following:
public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}
private EntityTypes _type;
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
I've tried setting different names for each class but it didn't help
Any help would be greatly appreciated.
Gonzalo- Ocultar texto de la cita -

- Mostrar texto de la cita -

Thanks for your help shaun, but that doesn't seem to work. Any other
ideas?
Feb 15 '07 #4
On 15 feb, 17:38, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Gonza,

Try giving the classes different names using the XmlElement attribute.

--
Shaun McDonnell
.NET Software Architect
407.902.8238

"Gonza" <gonza...@gmail .comwrote in message

news:11******** *************@p 10g2000cwp.goog legroups.com...
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Gonza,
The problem is that both your base class and the class inheriting from it
have the same property name. You can specify with an attribute a
different
name to use like this:
[XmlElement("Ent ityTypeCollecti on")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
Shaun McDonnell
"Gonza" <gonza...@gmail .comwrote in message
>news:11******* *************** @h3g2000cwc.goo glegroups.com.. .
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.
The code for the class in question (and it's superclass) is the
following:
public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}
private EntityTypes _type;
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
I've tried setting different names for each class but it didn't help
Any help would be greatly appreciated.
Gonzalo- Ocultar texto de la cita -
- Mostrar texto de la cita -
Thanks for your help shaun, but that doesn't seem to work. Any other
ideas?- Ocultar texto de la cita -

- Mostrar texto de la cita -
I can set the attribute to the class, it doesn't compile. Thanks for
your help shaun

Feb 15 '07 #5
Use the XmlRoot attribute on the class.

--
Shaun McDonnell
..NET Software Architect
407.902.8238

"Gonza" <go******@gmail .comwrote in message
news:11******** **************@ q2g2000cwa.goog legroups.com...
On 15 feb, 17:38, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
>Gonza,

Try giving the classes different names using the XmlElement attribute.

--
Shaun McDonnell
.NET Software Architect
407.902.8238

"Gonza" <gonza...@gmail .comwrote in message

news:11******* **************@ p10g2000cwp.goo glegroups.com.. .
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Gonza,
>The problem is that both your base class and the class inheriting from
it
have the same property name. You can specify with an attribute a
different
name to use like this:
>[XmlElement("Ent ityTypeCollecti on")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
>}
>Shaun McDonnell
>"Gonza" <gonza...@gmail .comwrote in message
>>news:11****** *************** *@h3g2000cwc.go oglegroups.com. ..
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and
'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use
XML
attributes to specify a unique XML name and/or namespace for the
type.
The code for the class in question (and it's superclass) is the
following:
public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}
private EntityTypes _type;
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
I've tried setting different names for each class but it didn't help
Any help would be greatly appreciated.
Gonzalo- Ocultar texto de la cita -
>- Mostrar texto de la cita -
Thanks for your help shaun, but that doesn't seem to work. Any other
ideas?- Ocultar texto de la cita -

- Mostrar texto de la cita -

I can set the attribute to the class, it doesn't compile. Thanks for
your help shaun
Feb 15 '07 #6
On 15 feb, 18:16, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Use the XmlRoot attribute on the class.

--
Shaun McDonnell
.NET Software Architect
407.902.8238

"Gonza" <gonza...@gmail .comwrote in message

news:11******** **************@ q2g2000cwa.goog legroups.com...
On 15 feb, 17:38, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Gonza,
Try giving the classes different names using the XmlElement attribute.
--
Shaun McDonnell
.NET Software Architect
407.902.8238
"Gonza" <gonza...@gmail .comwrote in message
>news:11******* **************@ p10g2000cwp.goo glegroups.com.. .
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@e isoft.com>
wrote:
Gonza,
The problem is that both your base class and the class inheriting from
it
have the same property name. You can specify with an attribute a
different
name to use like this:
[XmlElement("Ent ityTypeCollecti on")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
Shaun McDonnell
"Gonza" <gonza...@gmail .comwrote in message
>news:11******* *************** @h3g2000cwc.goo glegroups.com.. .
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and
'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use
XML
attributes to specify a unique XML name and/or namespace for the
type.
The code for the class in question (and it's superclass) is the
following:
public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}
private EntityTypes _type;
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
I've tried setting different names for each class but it didn't help
Any help would be greatly appreciated.
Gonzalo- Ocultar texto de la cita -
- Mostrar texto de la cita -
Thanks for your help shaun, but that doesn't seem to work. Any other
ideas?- Ocultar texto de la cita -
- Mostrar texto de la cita -
I can set the attribute to the class, it doesn't compile. Thanks for
your help shaun- Ocultar texto de la cita -

- Mostrar texto de la cita -
Nope, that doesn't work either

Feb 16 '07 #7
The problem is that the enums are called the same thing and need to have the
XmlElementAttri bute attached to one of them so they can be differentiated in
the XML.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Gonza" wrote:
Hi group, i'm getting the following excepction while trying to
serialize a class:

Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.

The code for the class in question (and it's superclass) is the
following:

public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}

private EntityTypes _type;

public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}

private EntityTypes _type;

public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}

I've tried setting different names for each class but it didn't help

Any help would be greatly appreciated.

Gonzalo

Feb 16 '07 #8
On 16 feb, 11:03, Ciaran O''Donnell
<CiaranODonn... @discussions.mi crosoft.comwrot e:
The problem is that the enums are called the same thing and need to have the
XmlElementAttri bute attached to one of them so they can be differentiated in
the XML.

--
Ciaran O''Donnellhttp://wannabedevelope r.spaces.live.c om

"Gonza" wrote:
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinanc e.BusinessEntit ies.ExtendedBas eEntityTypeData .EntityTypes'
and 'NYC.TrueFinanc e.BusinessEntit ies.BaseEntityT ypeData.EntityT ypes'
both use the XML type name, 'EntityTypes', from namespace ''. Use XML
attributes to specify a unique XML name and/or namespace for the type.
The code for the class in question (and it's superclass) is the
following:
public class BaseEntityTypeD ata {
public enum EntityTypes {
EntesRegistrale s,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEnt ityTypeData:Bas eEntityTypeData
{
public new enum EntityTypes
{
Actividades,
TiposCarteras
}
private EntityTypes _type;
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
}
I've tried setting different names for each class but it didn't help
Any help would be greatly appreciated.
Gonzalo- Ocultar texto de la cita -

- Mostrar texto de la cita -
The problem is taht i can't set the XmlElementAttri bute to one of the
enums, it won't compile.

Feb 16 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3179
by: Aaron Clamage | last post by:
Hi, I'm not sure that if this is the right forum, but any help would be greatly appreciated. I am porting some java serialization code to c# and I can't figure out the correct way to do it. It seems that either I can use default serialization or implement ISerializable. Is there any way to do both (e.g. extend the default serialization). In other words, I want to be able to implement my custom serialization code but call the...
5
2369
by: Arjen | last post by:
Hello, Can somebody help me a little bit? I can't get it to work. Please see my code below... I have placed some comments like "// And whats next?". I'm sure that I have to code something here. But what? What do I want?
1
2866
by: Opa | last post by:
Hi I'm having problem serialization an object instance which contains a public property on the object type My object hierarchy is many levels deep, so for simplicty I created to following which produces the same error Let's say there is a class called ParkingSpot with a public member Vehicle having an object type of object For simplicity, let's say that Vehicle could be anything, hence I create a new object of Car typ and assign it to...
5
2834
by: francois | last post by:
First of all I would to to apologize for resending this post again but I feel like my last post as been spoiled Here I go for my problem: Hi, I have a webservice that I am using and I would like it to return an XML serialized version of an object.
6
2719
by: Uttam | last post by:
Hello, We are at a very crucial decision making stage to select between .Net and Java. Our requirement is to download a class at runtime on the client computer and execute it using remoting or rmi. Just to keep my question short I am posting trimmed version of my code. //file: Serializable.cs
2
2593
by: Maximus | last post by:
Hi Everyone, I was using Inprocess session objects, but incase of aspnet process crashes the session objects were lost as a result I decided to shift to out of porocess session objects. For this i had to serialize the objects. While doing that I made the classes serializable whose objects I store in sessions. However, when I run the application I get the following error.
8
315
by: vinay | last post by:
Hi Guys I want to understand Serialization. What is serialization. When do we need to use?? What are advantages and Disadvantages. Also please diret me to some good sites on serialization. Thanks for all ur help.
6
3828
by: pamela fluente | last post by:
Hi, please find below a very simple code snippet which is giving me the following error: System.Runtime.Serialization.SerializationException was unhandled Message="The constructor to deserialize an object of type 'WindowsApplication10.Form1+DictionaryExt`2' was not found." Source="mscorlib" You can just past the snippet on any form with a button.
8
12575
by: =?Utf-8?B?UGlnZ3k=?= | last post by:
Hi to all, I am getting this System.OutOfMemoryException calling the Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(<stream>,<Obj>) method. The type of <streamis IO.MemoryStream =====Exception: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
2
5569
by: mkvenkit.vc | last post by:
Hello, I hope this is the right place to post a question on Boost. If not, please let me know where I can post this message and I will do so. I am having a strange problem with std::string as I am trying to read from a binary archive using Boost serialization. I am new to this, and it is possible that I have not understood the usage. In the code below, the string "faultblock" seems to be causing the problem. The code crashes in the ia...
0
9708
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.