I have three classes: Hotel (implements IHotel) , Room (implements IRoom , which is inherited from IRoomDetails and IBookedRoom), ClientModel (implement IClientModel).
public interface IRoomDetails
{
string Number { get; set; }
float PricePerDay { get; set; }
}
public interface IBookedRoom
{
bool IsAvailable { get; set; }
IClientModel Reservator { get; set; }
string TermFrom { get; set; }
string TermTo { get; set; }
string Term { get; }
}
public interface IRoom : IRoomDetails , IBookedRoom
{
}
public class Room : ObservableObject, IRoom
{
//Realization here
}
If i try to serialize List<IRoomDetails>
all works perfect, as well as List<IBookedRoom>
, BUT if i create interface IRoom
, which inherits from both of them and try to serialize List<IRoom>
:
{
"Adress": "Pokrovska , 1B",
"Name": "Victoria",
"TotalRooms": 2,
"AvailableRooms": 2,
"Rooms": [
{},
{}
]
}
As we see data is not serialized. (List of rooms is not empty) . Any suggestions?