In the Common Data Services SDK Microsoft.CommonDataService
, I can select entities from the db with this code
// Specify the generic object to retrieve
var genericEntitySet = client.GetRelationalEntitySet(
new EntitySetReference("Microsoft.CommonDataService.CommonEntities",
AdvEntity.EntityName,
Microsoft.CommonDataService.Version.Create("1.0.0")));
// Specify the required fields
var query = genericEntitySet.CreateQueryBuilder()
.Project(pc =>
pc
.SelectField(f => f["PrimaryId"])
.SelectField(f => f["Project_Title"])
.SelectField(f => f["CreatedByUser"])
.SelectField(f => f["CreatedOnDateTime"])
.SelectField(f => f["LastModifiedByUser"])
.SelectField(f => f["LastModifiedDateTime"])
.SelectField(f => f["Opportuinity"])
.SelectField(f => f["BNB"])
.SelectField(f => f["SP_URL"])
.SelectField(f => f["ProjectMgr"])
.SelectField(f => f["WorkTeam"])
.SelectField(f => f["BnB_ID"])
.SelectField(f => f["Custodian"])
.SelectField(f => f["Stage"])
.SelectField(f => f["Opp_Status"])
.SelectField(f => f["Confidential"])
.SelectField(f => f["CRMT_Num"])
.SelectField(f => f["Proj_Num"])
.SelectField(f => f["Sector"])
.SelectField(f => f["Service"])
.SelectField(f => f["Archive"])
);
var selectExecutor = client.CreateRelationalBatchExecuter(
RelationalBatchExecutionMode.Transactional);
await selectExecutor
.Query(query, out OperationResult<IReadOnlyList<RelationalEntity>> queryResult)
.ExecuteAsync();
However, it seems cumbersome to have to select all those fields for every type of object I may need to retrieve.
Is there a way of just telling the code to get all properties?
The documentation states that
Note that, for performance reasons, there is no option to automatically select all fields.
This SDK is in preview and so there is not much information around about it, but perhaps someone knows a trick for this?