473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Serialization Problem - Please Help!

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

Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}

private EntityTypes _type;

public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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 1617
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("EntityTypeCollection")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}

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

Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}

private EntityTypes _type;

public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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...@eisoft.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("EntityTypeCollection")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}

}

Shaun McDonnell

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

news:11**********************@h3g2000cwc.googlegro ups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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*********************@p10g2000cwp.googlegro ups.com...
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@eisoft.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("EntityTypeCollection")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}

}

Shaun McDonnell

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

news:11**********************@h3g2000cwc.googlegr oups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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...@eisoft.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.googlegro ups.com...
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@eisoft.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("EntityTypeCollection")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
Shaun McDonnell
"Gonza" <gonza...@gmail.comwrote in message
>news:11**********************@h3g2000cwc.googlegr oups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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.googlegro ups.com...
On 15 feb, 17:38, "Shaun C McDonnell" <sm-nospammmmm...@eisoft.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.googlegr oups.com...
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@eisoft.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("EntityTypeCollection")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
>}
>Shaun McDonnell
>"Gonza" <gonza...@gmail.comwrote in message
>>news:11**********************@h3g2000cwc.googleg roups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and
'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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...@eisoft.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.googlegro ups.com...
On 15 feb, 17:38, "Shaun C McDonnell" <sm-nospammmmm...@eisoft.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.googlegr oups.com...
On 15 feb, 16:58, "Shaun C McDonnell" <sm-nospammmmm...@eisoft.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("EntityTypeCollection")]
public new EntityTypes Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
Shaun McDonnell
"Gonza" <gonza...@gmail.comwrote in message
>news:11**********************@h3g2000cwc.googlegr oups.com...
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and
'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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
XmlElementAttribute 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.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}

private EntityTypes _type;

public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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.microsoft.comwrote:
The problem is that the enums are called the same thing and need to have the
XmlElementAttribute attached to one of them so they can be differentiated in
the XML.

--
Ciaran O''Donnellhttp://wannabedeveloper.spaces.live.com

"Gonza" wrote:
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEnti tyTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeDa ta.EntityTypes'
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 BaseEntityTypeData {
public enum EntityTypes {
EntesRegistrales,
EstadosEstudio
}
private EntityTypes _type;
public EntityTypes Type
{
get { return _type; }
set { _type = value; }
}
}
public class ExtendedBaseEntityTypeData:BaseEntityTypeData
{
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 XmlElementAttribute 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
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. ...
5
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...
1
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...
5
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...
6
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...
2
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...
8
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....
6
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...
8
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...
2
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.