cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kiki
Regular Visitor

How to perform CRUD operations on CDS Entites using C# code

Hi,

 

I would like to perform CRUD operations on CDS Entites using C# code from an azure function.

 

How can I do that ?

 

Thanks,

 

Arioule

1 ACCEPTED SOLUTION

Accepted Solutions
EricRegnier
Super User
Super User

Hi @Kiki,

There are multiple methods using the SDK which you can download form nuget https://www.nuget.org/packages/Microsoft.CrmSdk.CoreTools

  1. LINQ for CRUDs:
    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/use-linq-constr...

    Some examples: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/linq-query-exam...

    Use can user either early or late bounds. To know the difference, check out this link: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/early-bound-pro...

    There are pros and cons for both which is more for an advanced topic but early bounds is the more popular method because of strong typings and intellisense. There also a tool part of the XrmToolBox to facilitate the generation: https://www.xrmtoolbox.com/plugins/DLaB.Xrm.EarlyBoundGenerator/


  2. QueryExpression to read:
    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/build-queries-w...

  3. FetchXML to query:
    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-construct-quer...

  4. For create, update, upsert, delete and operations without LINQ:
    1. Create: https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.createrequest?view=dynamics-g...
    2. Upsert: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-upsert-insert-update-re...
    3. Update: https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.updaterequest?view=dynamics-g...
    4. Delete: https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.deleterequest?view=dynamics-g...

Lots of links, but hope this helps!

View solution in original post

2 REPLIES 2
EricRegnier
Super User
Super User

Hi @Kiki,

There are multiple methods using the SDK which you can download form nuget https://www.nuget.org/packages/Microsoft.CrmSdk.CoreTools

  1. LINQ for CRUDs:
    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/use-linq-constr...

    Some examples: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/linq-query-exam...

    Use can user either early or late bounds. To know the difference, check out this link: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/early-bound-pro...

    There are pros and cons for both which is more for an advanced topic but early bounds is the more popular method because of strong typings and intellisense. There also a tool part of the XrmToolBox to facilitate the generation: https://www.xrmtoolbox.com/plugins/DLaB.Xrm.EarlyBoundGenerator/


  2. QueryExpression to read:
    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/build-queries-w...

  3. FetchXML to query:
    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-fetchxml-construct-quer...

  4. For create, update, upsert, delete and operations without LINQ:
    1. Create: https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.createrequest?view=dynamics-g...
    2. Upsert: https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/use-upsert-insert-update-re...
    3. Update: https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.updaterequest?view=dynamics-g...
    4. Delete: https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.deleterequest?view=dynamics-g...

Lots of links, but hope this helps!

Thanks a lot for your help

 

Regards,

 

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Users online (3,809)