Using OData v4 I created a Singleton
builder.Singleton<Company>("BluAndYellow");
There is a function, that shall return that singleton
builder.Namespace = "Workflow";
builder.EntityType<Employee>()
.Action("Hire")
.Returns<Company>();
This throws an exception
The EDM type 'Services.WebAPI.Company' is already declared as an entity type. Use the method 'ReturnsFromEntitySet' if the return type is an entity.
However, when using ReturnsFromEntitySet
I am required to reference an entity set, which of course doesn't exist for a Singleton.
What is the right way to return a Singleton from a Funtion?
Frank
So far, return a singleton form a function/action is considered meaningless. Because, Singleton is a special entity. It has the certain identification, for example the 'Uri`. Users can always query the singleton from such certain 'ID'. Therefore, neither ODL, nor Web API OData doesn't support to return a singleton from a function/action. Besides, Delete a singleton is also considered meaningless.
Hope it can help you. Thanks.