Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions dotnet/src/dotnetframework/GxClasses/Domain/GxCollections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2201,11 +2201,7 @@ public override short readxmlcollection(GXXMLReader oReader, string sName, strin
return 0;
}
}
#if !NETCORE
public class GXCData : Object, IXmlSerializable
#else
public class GXCData : Object
#endif
public class GXCData : IXmlSerializable
{
public string content;

Expand All @@ -2217,7 +2213,6 @@ public GXCData(string s)
{
content = s;
}
#if !NETCORE
public System.Xml.Schema.XmlSchema GetSchema()
{
return new System.Xml.Schema.XmlSchema();
Expand All @@ -2230,13 +2225,8 @@ public void WriteXml(System.Xml.XmlWriter writer)
{
writer.WriteCData(content);
}
#endif
}
#if !NETCORE
public class GXXmlRaw : Object, IXmlSerializable
#else
public class GXXmlRaw : Object
#endif
public class GXXmlRaw : IXmlSerializable
{
public string content;

Expand All @@ -2248,7 +2238,6 @@ public GXXmlRaw(string s)
{
content = s;
}
#if !NETCORE
public System.Xml.Schema.XmlSchema GetSchema()
{
return new System.Xml.Schema.XmlSchema();
Expand All @@ -2261,7 +2250,6 @@ public void WriteXml(System.Xml.XmlWriter writer)
{
writer.WriteRaw(content);
}
#endif
}

public class GXProperties : NameObjectCollectionBase, IGxJSONSerializable, IGxJSONAble
Expand Down
13 changes: 13 additions & 0 deletions dotnet/test/DotNetCoreUnitTest/Domain/SdtXmlSerializationTest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.IO;
using GeneXus.Application;
using GeneXus.Programs;
using Xunit;
Expand Down Expand Up @@ -25,5 +26,17 @@ public void EmptyValuesDeserializationTest()
Assert.True(shouldSerializeField, "Departamento should be serialized since it was assigned during XML deserialization");

}

[Fact]
public void GXCDataDeserializationTest()
{
GxContext context = new GxContext();
SdtInvoicyretorno invoice = new SdtInvoicyretorno(context);
string xml = File.ReadAllText("invoicy.xml");

invoice.FromXml(xml, null, "Invoicyretorno", "InvoiCy");
Assert.Contains("40047", invoice.ToJSonString(), System.StringComparison.OrdinalIgnoreCase);

}
}
}
139 changes: 139 additions & 0 deletions dotnet/test/DotNetCoreUnitTest/Domain/type_SdtInvoicyretorno.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
File: type_SdtInvoicyretorno
Description: Invoicyretorno
Author: Nemo 🐠 for C# (.NET) version 18.0.13.186668
Program type: Callable routine
Main DBMS:
*/
using GeneXus.Application;
using GeneXus.Utils;
using System.Collections;
using System.Xml.Serialization;


namespace GeneXus.Programs
{
[XmlRoot(ElementName="Invoicyretorno")]
[XmlType(TypeName="Invoicyretorno" , Namespace="InvoiCy" )]
public class SdtInvoicyretorno : GxUserType
{
public SdtInvoicyretorno( )
{
/* Constructor for serialization */
}

public SdtInvoicyretorno(IGxContext context)
{
this.context = context;
initialize();
}

#region Json
private static Hashtable mapper;
public override string JsonMap(string value)
{
if (mapper == null)
{
mapper = new Hashtable();
}
return (string)mapper[value]; ;
}

public override void ToJSON()
{
ToJSON(true) ;
return;
}

public override void ToJSON(bool includeState)
{
if (gxTv_SdtInvoicyretorno_Mensagem != null)
{
AddObjectProperty("Mensagem", gxTv_SdtInvoicyretorno_Mensagem, false);
}
return;
}
#endregion

#region Properties

[SoapElement(ElementName="Mensagem" )]
[XmlArray(ElementName="Mensagem" )]
[XmlArrayItemAttribute(ElementName="MensagemItem" , IsNullable=false )]
public GXBaseCollection<SdtInvoicyretorno_MensagemItem> gxTpr_Mensagem
{
get {
if ( gxTv_SdtInvoicyretorno_Mensagem == null )
{
gxTv_SdtInvoicyretorno_Mensagem = new GXBaseCollection<SdtInvoicyretorno_MensagemItem>( context, "Invoicyretorno.MensagemItem", "");
}
SetDirty("Mensagem");
return gxTv_SdtInvoicyretorno_Mensagem;
}
set {
gxTv_SdtInvoicyretorno_Mensagem_N = false;
gxTv_SdtInvoicyretorno_Mensagem = value;
SetDirty("Mensagem");
}
}

public void gxTv_SdtInvoicyretorno_Mensagem_SetNull()
{
gxTv_SdtInvoicyretorno_Mensagem_N = true;
gxTv_SdtInvoicyretorno_Mensagem = null;
}

public bool gxTv_SdtInvoicyretorno_Mensagem_IsNull()
{
return gxTv_SdtInvoicyretorno_Mensagem == null;
}
public bool ShouldSerializegxTpr_Mensagem_GxSimpleCollection_Json()
{
return gxTv_SdtInvoicyretorno_Mensagem != null && gxTv_SdtInvoicyretorno_Mensagem.Count > 0;

}


public override bool ShouldSerializeSdtJson()
{
return (
ShouldSerializegxTpr_Mensagem_GxSimpleCollection_Json() ||
false);
}



#endregion

#region Static Type Properties

[XmlIgnore]
private static GXTypeInfo _typeProps;
protected override GXTypeInfo TypeInfo { get { return _typeProps; } set { _typeProps = value; } }

#endregion

#region Initialization

public void initialize( )
{
gxTv_SdtInvoicyretorno_Mensagem_N = true;

return ;
}



#endregion

#region Declaration

protected bool gxTv_SdtInvoicyretorno_Mensagem_N;
protected GXBaseCollection<SdtInvoicyretorno_MensagemItem> gxTv_SdtInvoicyretorno_Mensagem = null;



#endregion
}

}
Loading
Loading