0

I have an Azure SQL database so I created a Microsoft.Search service off it. I want to use that to build a virtual entity. Is this possible? I feel like the fact it wants a source that works, and a separate table name to append on the query, means it won't work.

Given I was getting nowhere, I created a WCF Data Service and it's giving me the OData service I need, but still not working....

I think I know the reason. My JSON response looks like this:

 "d": [
        {
            "__metadata": {
                "id": "https://localhost:44317/V4/Odata/Odata.svc/YOYParentContacts(guid'1b9d9acf-77cc-4c37-9735-30946e871d1b')",
                "uri": "https://localhost:44317/V4/Odata/Odata.svc/YOYParentContacts(guid'1b9d9acf-77cc-4c37-9735-30946e871d1b')",
                "type": "Model.YOYParentContact"
            },
            "id": "1b9d9acf-77cc-4c37-9735-30946e871d1b",

whereas a data source that works returns JSON like this:

{
  "@odata.context": "https://services.odata.org/V4/OData/OData.svc/$metadata#Advertisements",
  "value": [
    {
      "@odata.mediaReadLink": "Advertisements(f89dee73-af9f-4cd4-b330-db93c25ff3c7)/$value",
      "@odata.mediaContentType": "*/*",
      "@odata.mediaEtag": "\"8zOOKKvgOtptr4gt8IrnapX3jds=\"",
      "ID": "f89dee73-af9f-4cd4-b330-db93c25ff3c7",

So it seems reasonable to then assume that the different format JSON being returned by my simple WCF Data Service is the cause of my issue. So my question becomes, using a WCF Data Service, how do I shape the JSON it returns?

Thanks

cgraus
  • 784
  • 2
  • 9
  • 26
  • Doesn't Dynamics already use OData? In fact, given that the current versions are Cloud-first, it's Microsoft Graph and OData – Panagiotis Kanavos Sep 29 '20 at 08:32
  • clearly the way you are exposing your dataset as Odata is not the expected respone to dynamics/virtual entity. I would propose you add Retrieve multiple and retrive plugin on your WCF data and then update your response. as mentioned in my answer try to visit this [blog](https://carinaclaesson.com/2020/01/30/virtual-entities-how-to-create-a-custom-data-provider/) and work it through – AnkUser Sep 30 '20 at 10:49

1 Answers1

0

As long as you have an source and tables of it and you can retrieve data from it your are good to go.

You can either have out of box odata provider or you can create Custom data provider. It is not a big deal, Here is an nice example of how to achieve this

AnkUser
  • 5,421
  • 2
  • 9
  • 25
  • Thanks. The issue is, I created an OData source and Dynamics gives me an error when I point to it – cgraus Sep 28 '20 at 21:27
  • I guess you do know there are some ground rules to have virtual entity data in Dynamics. Take a look at this [doc](https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/virtual-entity-odata-provider-requirements) from Mircosoft – AnkUser Sep 29 '20 at 08:44