on 07-22-2016 4:39 PM
Hi,
I wonder if it is possible, to build XS OData Services based on XSDS (XS Data Services) managed entities.
asume a CDS entity named post is defined at .hdbdd file.
entity post {
key pid: Integer not null;
Title: String(63) not null;
Text: text;
Author: association [1] to user;
Parent: association [0..1] to post;
Rating: Integer;
Created: UTCDateTime;
//Comments: association [0..*] to comment via backlink Parent; //One-to-Many Associations via backlink
//Tags: association [0..*] to ds_comments via entity tags_by_post; //Many-to-Many Associations via entity
Replies: Association[*] to post on Replies.Parent.pid = pid; //Unmanaged Associations (can be defined at XSDS too)
};
As One-to-Many Associations via backlink and Many-to-Many Associations via entity are not supported yet at cds, these Associations are defined using XSDS.
var Post = XSDS.$importEntity("sap.hana.democontent.xsds", "bboard.post", {
//One-to-Many Associations
Comments: {
$association: {
$entity: "sap.hana.democontent.xsds::bboard.comment",
$viaBacklink: "Parent"
}
},
// Many-to-Many Associations
Tags: {
$association: {
$entity: "sap.hana.democontent.xsds::bboard.tag",
$viaEntity: "sap.hana.democontent.xsds::bboard.tags_by_post",
$source: "post",
$target: "tag",
}
},
so is it possible to create an XS OData service which is based on Post managed entity and inherits all the associations and metadata defined at cds and xsds level?
Kind regards
Rouzbeh
No this is not possible. You have to redefine the entity/associations within the XSODATA service definition. XSODATA only accepts database table, SQL view, and modeled views as its source. You can use XSDS within the Create/Update/Delete exits of an XSODATA service if you wish.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.