I have a custom Collection to control the changes made to it, and revert changes if I need to, similar to the implementation of the IEditableObject
public class CollectionBO<TEntity> : Collection<TEntity> where TEntity : BOBase
{
public List<TEntity> AddedEntities { get; set; }
public List<TEntity> RemovedEntities { get; set; }
public CollectionBO()
{
AddedEntities = new List<TEntity>();
RemovedEntities = new List<TEntity>();
}
}
I want to use that list also in the DTO of a rest api, to access the information of the records to be removed or added easily, but the problem I have is that it does not serialize the internal lists (AddedEntities, RemovedEntities), when they arrive to the server, those lists are always empty, the question is it possible to serialize a list and even its IList properties
await (serverUrl).AppendPathSegment(endPoit)
.WithOAuthBearerToken(token)
.PutJsonAsync(CollectionBO);