createRelatedEntity

open suspend fun createRelatedEntity(entity: EntityValue, parent: EntityValue, property: Property)

See createRelatedEntity_(EntityValue, EntityValue, Property, HttpHeaders?, RequestOptions?).

Parameters

entity

Entity parameter.

parent

Parent parameter.

property

Property parameter.


open suspend fun createRelatedEntity(entity: EntityValue, parent: EntityValue, property: Property, headers: HttpHeaders?)

See createRelatedEntity_(EntityValue, EntityValue, Property, HttpHeaders?, RequestOptions?).

Parameters

entity

Entity parameter.

parent

Parent parameter.

property

Property parameter.

headers

Headers parameter.


open suspend fun createRelatedEntity(entity: EntityValue, parent: EntityValue, property: Property, headers: HttpHeaders?, options: RequestOptions?)

Create an entity in the target system, related to an existing parent entity via a parent navigation property.

Example using proxy classes:
open fun createRelatedEntityExample(): kotlin.Unit
{
    val service = this.service;
    val customer = service.getCustomer(DataQuery().top(1)
        .filter(Customer.customerID.equal("ALFKI")));
    val orders = service.getOrders(DataQuery().top(1));
    val newOrder = orders.get(0).copy();
    service.createRelatedEntity(newOrder, customer, Customer.orders);
}
Example using dynamic API:
open fun createRelatedEntityExample(): kotlin.Unit
{
    val service = this.service;
    val customersEntitySet = service.getEntitySet("Customers");
    val ordersEntitySet = service.getEntitySet("Orders");
    val customerEntityType = customersEntitySet.entityType;
    val customerIDProperty = customerEntityType.getProperty("CustomerID");
    val ordersProperty = customerEntityType.getProperty("Orders");
    val customers = service.executeQuery(DataQuery().from(customersEntitySet)
        .filter(customerIDProperty.equal("ALFKI")))
        .getEntityList();
    val orders = service.executeQuery(DataQuery().from(ordersEntitySet).top(1))
        .getEntityList();
    val customer = customers.first();
    val newOrder = orders.first().copyEntity();
    service.createRelatedEntity(newOrder, customer, ordersProperty);
}

Parameters

entity

Entity to be created.

parent

Previously created parent entity.

property

Parent's navigation property.

headers

(nullable) Optional request-specific headers.

options

(nullable) Optional request-specific options.