SenseNet / sn-client-dotnet

A .Net client for sensenet that makes it easy to use the REST API of the Content Repository.
https://www.sensenet.com/
GNU General Public License v2.0
7 stars 16 forks source link

Try to create the content from the desired type #137

Closed kavics closed 1 month ago

kavics commented 5 months ago

When loading/querying a content/collection with a desired type parameter, and a content type is not registered yet, try to create the missing type from the type parameter instead of "Content".

For example: The API call is the following:

var collection = await repository.QueryAsync<Item1>(request, CancellationToken.None);

The response

{"d": {"__count": 4, "results": [
    {"Id": 10001, "Name": "Content1", "Type": "Item1"},
    {"Id": 10002, "Name": "Content2", "Type": "Item2"},
    {"Id": 10003, "Name": "Content3", "Type": "Item3"},
    {"Id": 10004, "Name": "Content4", "Type": "Item4"},
]}}

If the "Item1", "Item2", and "Item3" are registered but "Item4" is not registered, the expected content type names:

Item1, Item2, Item3, Item1