RestSharp: to include or not include?

I am debating whether to include or not include a third party library in the client folder, but I wanted to open the discussion up about why this is either a good idea or a bad idea?
I don’t particularly like the idea of managing another library that’s not included in Epicor’s files, but sometimes it seems unavoidable…

1 Like

If you don’t like including third party libraries don’t look at what Epicor is doing next: npm | Sign In

Err, if it comes with Epicor I don’t care, I more so meant like including my own 3rd party libraries and integrating them into the client install

1 Like

This is an excellent question @Aaron_Moreng. You generally want to reduce your dependencies as much as possible to maintain clean code. But you shouldn’t have to write everything from scratch either! The two most popular strategies is to wrap the library into a class and make it work for your problem domain. Hide the details of the library itself so that if library falls out of date or there is a better one, you can change your class and swap in a new library but all of your application code remains unchanged.

The other option is to write to an interface and use dependency injection. (C# With Dependency Injection | Codementor)

However, these options are tough for the Client customizations. If there was a central repository of shared code then you could do it.

As John pointed out, using third party libraries is unavoidable but how we include them makes them easier to manage.

Mark W.

1 Like

Mark, thank you for the nice overview of techniques!! I love software engineering because there is always something to learn.
Unfortunately for me, this is a client customization, and to my knowledge, the assemblies available to reference inside of a client customization must live within the Client folder. If my understanding of DI is correct (it probably isn’t), I’d still need to have visibility to the assembly of which I would create the interface from.
If it were a non-Epicor application, I think the library would still need to be referenced in the code set, but it would obviously be a interfaced with via separate class or service altogether.

I use a custom install technique for our client installs, which is basically zipping up the client folder on the Server install (when a new version is ready to be pushed out), pushing it to a file server, and then custom scripts that the user runs to xcopy the zipped client folder from the file server down to the workstation. This custom script could easily be modified to include any other xcopy of files into the new workstation Epicor client folder, but I didn’t know if other people are using better techniques to accomplish this. Surely, there is an elegant solution to this problem…

The final goal of this is getting RestSharp into my client installs seamlessly so that I can use what all the cool kids are using for their REST clients within my custom client side code :slight_smile:

1 Like

Some of this may have gone over my head slightly, but we have a couple of little dll files that are needed for some customizations, and they get downloaded to users’ client folders via the normal Epicor means. If you put them in the “Custom” folder on the server, and add a line to the master config file, the standard Epicor update process handles it all for you.

I have regular doubts whether adding dll files is a great idea, so I was interested to see what this discussion came up with, but if that is what you want then Epicor does make it relatively smooth.

What Daryl said is the easiest way to distribute dlls to the client - unless you’re Dedicated or Multi-Tenant user. With DI, you can dynamically link libraries at run time. Programs with DI will often use a start-up file to determine a particular provider but you’re correct, the program will need access to the assembly in a known location.

But getting the assemblies to the client is part of the problem. The discussion above is more about how to call the libraries in a way that makes it easier to upgrade or replace if a better library comes along. At some point, Epicor will probably include a way to call REST services. Will Aaron have to rewrite all of his customizations? If so, is there a way to make that process easier? It’s difficult to predict the future so these are some techniques others have used to help reduce the risk of dependency.

Mark W.

1 Like

I include CEFSharp and sounds and additional graphics in gfx folder. I distribute it to the Clients via a .zip and the .sysconfig - harmless.

2 Likes