Serialization Problem - Please Help!

  • Thread starter Thread starter Gonza
  • Start date Start date
G

Gonza

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

Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEntityTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeData.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
 
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,

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




Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEntityTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeData.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?
 
Gonza,

Try giving the classes different names using the XmlElement attribute.

--
Shaun McDonnell
..NET Software Architect
407.902.8238

Gonza said:
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




Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEntityTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeData.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?
 
Gonza,

Try giving the classes different names using the XmlElement attribute.

--
Shaun McDonnell
.NET Software Architect
407.902.8238




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

Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEntityTypeData.EntityTypes'
and 'NYC.TrueFinance.BusinessEntities.BaseEntityTypeData.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
 
Use the XmlRoot attribute on the class.

--
Shaun McDonnell
..NET Software Architect
407.902.8238

Gonza said:
Gonza,

Try giving the classes different names using the XmlElement attribute.

--
Shaun McDonnell
.NET Software Architect
407.902.8238




On 15 feb, 16:58, "Shaun C McDonnell" <[email protected]>
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
Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEntityTypeData.EntityTypes'
and
'NYC.TrueFinance.BusinessEntities.BaseEntityTypeData.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
 
Use the XmlRoot attribute on the class.

--
Shaun McDonnell
.NET Software Architect
407.902.8238




Gonza,
Try giving the classes different names using the XmlElement attribute.
--
Shaun McDonnell
.NET Software Architect
407.902.8238

On 15 feb, 16:58, "Shaun C McDonnell" <[email protected]>
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

Hi group, i'm getting the following excepction while trying to
serialize a class:
Types
'NYC.TrueFinance.BusinessEntities.ExtendedBaseEntityTypeData.EntityTypes'
and
'NYC.TrueFinance.BusinessEntities.BaseEntityTypeData.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
 
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.
 
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
















- Mostrar texto de la cita -

The problem is taht i can't set the XmlElementAttribute to one of the
enums, it won't compile.
 
Back
Top