Sync Employee Data to Dataverse

Project on GitHub: fertileverve/WebAPICall-Tutorial

After gaining the Foundational C# certification, I wanted to set myself a project that would be relevant to the type of work I have been doing most of my career. If you are lucky in Corporate America, there is a single system that can manage HR and Finance. However, most times employee data is in a separate system and needs to get updated in other systems, such as the IT employee directory, payroll system, or the Finance ERP.

My project was to connect to a free API that has some kind of fake people data and get that data to Microsoft’s Dataverse.

I chose to keep the project simple and create a C# console application to do the work, even though there are plenty of others ways, perhaps easier ways, to accomplish the goal. I had already signed up for the free Microsoft Dev Essentials program, which gave me an Azure tenant and a Power App environment. I setup a default model-driven app and created an Employee table and setup some basic columns. Now I needed to find some employe data from a free API and chose DummyJSON.

All set. Time to get coding!

It was standard research landing on mostly Microsoft documentation and Stack Exchange. I learned code by piecing it together, so I have been more of a “scripter” instead of an actual object-oriented programmer. I had learned a few things during my research and started working with the appsettings file. I don’t want to show code, but you can a version where I had the sync working but I knew there was plenty of bad practices implemented.

First Pass at Complete Application

I then searched for the best free AI to work with code and ended up working with Claude. I provided my files and asked it to review for security and best practices. I saved the response on GitHub if you are interested.

I had already read that I should not use the http client the way I did, and that showed up on the Claude suggestions as well, so I got started researching that. An implementation of a factory was way beyond me and I was not sure if that would work in a console app and could not find an example. I turned to Claud to show me the code in a console context and it could. That helped me to find what to research so I could learn more about factories and how they work.

Which led me to interfaces, services, depedency injection, and so much more. If you research code online and are trying to learn something new, I would recommend a guided learning with AI. So much faster!

I had a lot of fun working on this project and getting much more decent results with my code. I plan to continue this project and add in some unit tests next. For now, it works, it logs, it’s good code.

Second Pass at Complete Application