You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public abstract class Animal
{
public Guid RequestId { get; set; }
}
public class Cat : Animal
{
public string Name { get; set; }
}
public class Dog : Animal
{
public string Name { get; set; }
}
and the following service definition:
[ServiceContract]
public interface ITestService
{
[OperationContract]
Cat GetCat();
[OperationContract]
Dog GetDog();
[OperationContract]
bool CheckAnimalStatus(Animal animal);
}
It should be possible for the consumer to do something like the following:
service.OpenAsync().Wait();
var cat = service.GetCatAsync().Result;
while (service.CheckAnimalStatusAsync(cat).Result)
{
Console.WriteLine($"Cat id: {cat.RequestId}, name: {cat.Name} is ok.");
}
service.CloseAsync().Wait();
However the current serialization strategy is to serialize all properties, including properties from a parent class into one class, see:
This results in a class looking like the following being generated:
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("dotnet-svcutil", "1.0.0.1")]
[System.Runtime.Serialization.DataContractAttribute(Name="Cat", Namespace="http://schemas.datacontract.org/2004/07/CoreService")]
public partial class Cat : object
{
private string NameField;
private System.Guid RequestIdField;
[System.Runtime.Serialization.DataMemberAttribute()]
public string Name
{
get
{
return this.NameField;
}
set
{
this.NameField = value;
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public System.Guid RequestId
{
get
{
return this.RequestIdField;
}
set
{
this.RequestIdField = value;
}
}
}
As this class does not inherit the 'Animal' parent class, it is not able to be used to pass into the 'CheckAnimalStatus' message.
What's the current plan for dealing with inheritance in serialization? I'd be happy to help out and work on this feature but I think it's worth a discussion on desired approach first.
Additional Info
This was tested against this mornings release of 0.9.9.4
The text was updated successfully, but these errors were encountered:
Given the following basic class structure:
and the following service definition:
It should be possible for the consumer to do something like the following:
However the current serialization strategy is to serialize all properties, including properties from a parent class into one class, see:
This results in a class looking like the following being generated:
As this class does not inherit the 'Animal' parent class, it is not able to be used to pass into the 'CheckAnimalStatus' message.
What's the current plan for dealing with inheritance in serialization? I'd be happy to help out and work on this feature but I think it's worth a discussion on desired approach first.
Additional Info
This was tested against this mornings release of 0.9.9.4
The text was updated successfully, but these errors were encountered: