Dynamics 365 Virtual Entity demo.
A virtual entity is a definition of an entity in the Common Data Service platform metadata without the associated physical tables for entity instances created in the Common Data Service database. Instead during runtime, when an entity instance is required, its state is dynamically retrieved from the associated external system. |
in porgress. . . Download the project and click run. Even works on Mac!
in porgress. . .
set FLASK_APP=server.py
flask run
INFO
If you run into any issues running the code, debug the script using
python -m pdb .\server.py
Create resource group
export rg="rg-virtual-entities"
az group create -n $rg -l 'West US'
Create resources
export server="server-dynamics-unit-test"
export db="db--dynamics-unit-test"
az sql server create --admin-password 'Password!' --admin-user admin --location 'West US' -n $server -g $rg
# A server-level firewall rule allows an external application, such as SQL Server Management Studio or the SQLCMD utility to connect to a SQL database through the SQL Database service firewall.
# To enable external connectivity, change the IP address to an appropriate address for your environment. To open all IP addresses, use 0.0.0.0 as the startip and 255.255.255.255 as andip.
export startip="0.0.0.0"
export endip="255.255.255.255"
az sql server firewall-rule create -g $rg --server $server -n AllowAnyIp --start-ip-address $startip --end-ip-address $endip
az sql db create -g $rg --server $server -n $db
Deploy REST API with OData.
Used Mockaroo to generate test data. You can use curl to test and get a response.
curl "https://api.mockaroo.com/api/0ad55780?count=100&key=d9e7f2e0" > "WebOrder-Virtual-Entity.csv"
- Creating an OData v4 API with ASP.NET Core 2.0
- Modified from Getting started with OData in ASP.NET Core
- UsesMicrosoft.AspNetCore.OData and other NuGet libraries.
-
Modified from Building a Basic RestFul API in Python by Sagar Chand Agarwal
-
- Binaries for the SQLite DLL, and for the SQLite Command Shell. Unzip the contents of the files in a folder then add the folder to your PATH variable
- Helps to have the db browser for sqlite