Dynamics GP Developer Insights: .NET Interop

Alice Newsam - Click for blog homepageHello, my name is Alice Newsam and I am software engineer on the Dynamics GP team focusing on Dexterity and I have a question for you: 

Have you ever thought to yourself while working in Dexterity “I know there’s a .NET class that does this. It would be handy to access that right about now.” or “If only I could increase the string size to hold that data.”?

Well read on because you’ll be excited to learn about a feature that the GP Development team is currently working on for the GP 2015 release: .NET Interop.

This feature will bring the power of the .NET Framework into sanScript. Using .NET Interop, you’ll be able to reference .NET assemblies in your Dexterity dictionaries and your sanScript code will be able to create .NET objects and access fields, properties, methods, and events on those objects. Using .NET objects from sanScript can afford you greater flexibility to overcome things like sanScript’s limited string size, allow you to use dynamically sized collections, and give you direct access to alternate data sources like ADO.net.

How about a simple example to demonstrate: 

Here you can see that the syntax is very similar to C#.  We start off with a using directive which will allow us to use types from a namespace in a .NET library that we are referencing from our dictionary. That library contains a class for the Customer object which we are creating with the ‘new’ statement and will be returned to the caller of this procedure. Next you can see where we are interacting with the object by setting properties and calling methods. This is just a simple example of what can be done with .NET Interop, but you can imagine many more scenarios using existing .NET libraries and objects to help provide solutions for business scenarios.

Another benefit of the .NET Interop feature is that it expands on the capability to consume web services from within sanScript. The .NET Framework provides several classes that can be used to make web service calls and interpret the data used in the call. Along with helping to consume web services the .NET Interop feature also supports the effort to expose web services from Dynamics GP by providing a convenient mechanism for sending data in and out of a service procedure. This opens the possibilities up for a tremendous number of scenarios to extend and enhance the current product.

Additionally, along with unleashing the power of the .NET Framework via sanScript, the .NET Interop feature is also a foundational step to executing on the vision of Dynamics GP moving more fully towards a service based architecture. Since you can now reference and interact with a .NET object in Dexterity you can also use them as parameters for a service call. By reimagining the abilities of the toolset in this manner, the logic can be fully leveraged by Dynamics GP as well as contain additional logic for things like companion and integrating applications.   

The realization of features such as .NET Interop and others facilitating the new Service Based Architecture will provide an opportunity for the Dynamics GP application to significantly enhance reach and capability.  It not only will be able to more easily connect to other systems and services but also provide all of its capability for others to consume. This will make for some exciting times ahead. 

Stay tuned!

Alice