Dynamics GP Developer Insights: .NET Interop

Alice Newsam - Click for blog homepageThis is a reposting of an article Alice Newsam originally wrote on my Developing for Dynamics GP blog.

Hello, 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

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.

8 thoughts on “Dynamics GP Developer Insights: .NET Interop

  1. Wow Interop has only been around 13+ years and you just now got sanScript to work. You will bury yourselves with your ancient tools.

    Like

  2. Hi B
    Our ancient tools, namely Dexterity and its scripting language sanScript has served us very well over the years and continues to serve us.
    Dexterity forms an abstraction layer from the operating system and the database platform and has allowed code written 20 years ago to still run today, even in a web client.
    When Dexterity gained new functionality, all developers received that functionality with little or no effort on their behalf: For example: SQL Support, VBA Support, UI Improvements, Web Client.
    These latest enhancements will just add to the arsenal of tools we have with Dexterity, VBA, Visual Studio, etc.
    David

    Like

  3. So, are you expanding the sanScript language to include the foreach..in construct and other important constructs to address one of .NET's biggest foundations which is collections? Is it possible to get a preview document of the sanScript reference? I know a lot of this stuff is not set in stone, but it would help Dex developers all over to transition a lot easier to developing with these new constructs. Keep in mind that not all Dex developers are .NET developers and things like web services and even collections are still foreign concepts to most.  Better yet, why not have a Weekly Dynamics GP Developer Insight showing practical examples on how this stuff will work.
    Also, why not deal with the inherent deficiencies in sanScript while you are at it? Why not expand the string datatype to a larger size? Or the integer datatype to match at least those in .NET? I still cannot understand these self-imposed restrictions.
    Unrelated (not!), but when is Dexterity going to introduce support for SQL Server VARCHAR and NVARCHAR data types? CHAR is outdated and consumes tons of database space with a whole bunch of empty strings. When will we see support for Unicode? When will we see support for other database code pages?
    Please don't misinterpret my questions as attacks. I am truly excited about the new functionality, but like everyone else, I'm always left wanting more.
    MG.-
    Mariano Gomez
    Microsoft Dynamics GP MVP
    Intelligent Partnerships, LLC
    http://www.intelligentpartnerships.com

    Like

  4. Hi Mariano
    I will see if I can get someone from development to respond.
    I am sure they will be able to give you everything you want and more, before schedule and under budget.
    Now where did the magic wand and fairy dust end up.
    David

    Like

  5. Hi Mariano
    I got the response back from the development team:
    "We thank Mr. Gomez for his commentary regarding the Dexterity IDE and understand that advocates like himself will always desire additional capability in order to deliver increased value to our mutual customer base. We plan to continue our investment in the tools and technologies to enable features that best serve the needs of that base.  The last several releases have demonstrated that continued investment through the delivery of technologies like Web Client, Workflow and Doc Attach, which at their core utilize the Dexterity runtime and IDE as an evolving platform able to support the current and future needs of our partners and customers."
    David

    Like

Please post feedback or comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.