Rash thoughts about .NET, C#, F# and Dynamics NAV.

"Every solution will only lead to new problems."

Sunday, 6. January 2013

Bug in Microsoft Dynamics NAV 2013 OData services?!

Filed under: C#,Dynamics NAV 2013,Navision,Visual Studio — Steffen Forkmann at 10:24 Uhr

The “Walkthrough: Creating and Interacting with a Page Web Service (OData)” shows how we can easily access Dynamics NAV OData from the default company:

But somewhere in this process there seems to be a bug. If I want to access data from a different company I get a timeout:

I found a workaround for this, but if anybody knows more about this please write a comment.

Tags: , ,

Friday, 4. January 2013

F# and Microsoft Dynamics NAV 2013 OData Services

Filed under: C#,Diverses,Dynamics NAV 2009,Dynamics NAV 2013,F#,Visual Studio — Steffen Forkmann at 13:52 Uhr

In my last post I described how we can access Dynamics NAV 2009 SOAP web services from F# and the benefits we get by using a type provder. Since version 2013 it’s also possible to expose NAV pages via OData. In this article I will show you how the OData type provider which is part of F# 3 can help you to easily access this data.

Exposing the data

First of all follow this walkthrough and expose the Customer Page from Microsoft Dynamics NAV 2013 as an OData feed.

Show the available companies

Let’s try to connect to the OData feed and list all available companies. Therefore we create a new F# console project (.NET 4.0) in Visual Studio 2012 and add references to FSharp.Data.TypeProviders and System.Data.Services.Client. With the following snippet we can access and print the company names:

As you can see we don’t need to use the “Add Service Reference” dialog. All service type are generated on the fly.

Access data within a company

Unfortunately Dynamics NAV 2013 seems to have a bug in the generated metadata. In order to access data within a company we need to apply a small trick. In the following sample we create a modified data context which points directly to a company:

Now we can start to access the data:

As you can see this approach is very easy and avoids the problem with the manual code generation. If you expose more pages then they are instantly available in your code.

As with the Wsdl type provider you can expose the generated types from this F# project for use in C# projects.

Further information:

Tags: , , ,

Thursday, 3. January 2013

F# and Microsoft Dynamics NAV 2009 Web Services

Filed under: C#,Dynamics NAV 2009,F#,Navision,Visual Studio,WCF — Steffen Forkmann at 9:25 Uhr

If you are a Dynamics NAV developer you have probably heared of the web services feature which comes with the 2009 version. In this walkthrough you can learn how to create and consume a Codeunit Web Service. This method works very well if you only need to create the C# proxy classes once. If you have more than one developer, an automated build system, changing web services or many web services then you will come to a point where this code generation system is very difficult to handle.

Microsoft Visual F# 3.0 comes with feature called “type providers” that helps to simplify your life in such a situation. For the case of WCF the¬†Wsdl type provider¬†allows us to automate the proxy generation. Let’s see how this works.

Web service generation

In the first step we create the Dynamics NAV 2009 Codeunit web service in exactly the same way as in the MSDN walkthrough.

Connecting to the web service

Now we create a new F# console project (.NET 4.0 or 4.5) in Visual Studio 2012 and add references to FSharp.Data.TypeProviders, System.Runtime.Serialization and System.ServiceModel. After this we are ready to use the Wsdl type provider:

At this point the type provider creates the proxy classes in the background – no “add web reference” dialog is needed. The only thing we need to do is configuring the access security and consume the webservice:

Access from C#

This is so much easier than the C# version from the walkthrough. But if you want you can still access the provided types from C#. Just add a new C# project to the solution and reference the F# project. In the F# project rename Program.fs to Services.fs and expose the service via a new function:

In the C# project you can now access the service like this:

Changing the service

Now let’s see what happens if we change the service. Go to the Letters Codeunit in Dynamics NAV 2009 and add a second parameter (allLetters:Boolean) to the Capitalize method. After saving the Codeunit go back to the C# project and try to compile it again. As you can see the changes are directly reflected as a compile error.

In the next blog post I will show you how you can easily access a Dynamics NAV 2013 OData feed from F#.

Tags: , , ,

Tuesday, 5. February 2008

Sure Step Methodology Version 1.1 released

Filed under: Navision,Tools — Steffen Forkmann at 16:08 Uhr

Am 21.1. wurde eine neue Version von Microsofts Sure Step Methodology veröffentlicht. Unter anderem beinhaltet das Release auch Übersetzungen der Templates ins Deutsche – allerdings muss man die Links im Text in dieser Version leider noch selber umbiegen.

SureStep bietet umfangreiche Dokumentenvorlagen für nahezu jede Phase eines Projektes und über den mitgelieferten Editor kann man die Vorlagen noch an die eigenen Prozesse anpassen.

Sure Step Methodology Overview

Download Sure Step Methodology [PartnerSource]

Tags: ,

Saturday, 6. October 2007

BASTA! 2007 Vortrag – Programmierung mit Microsoft Dynamics NAV

Filed under: Dynamics NAV 2009,Navision,Veranstaltungen — Steffen Forkmann at 9:43 Uhr

Hier nun endlich die versprochenen Slides von meinem BASTA!-Vortrag. Es ging um einen Einstieg in die Navision-Programmierung und grundlegende Konzepte.

Tags: , ,

Tuesday, 2. October 2007

Artikel in der aktuellen Ausgabe des .NET-Magazins

Filed under: Dynamics NAV 2009,msu solutions GmbH,Navision,Steffen,WF — Steffen Forkmann at 11:36 Uhr

Heute erscheint die 51. Ausgabe des .NET-Magazins¬†mit dem¬†Hauptthema “Business.NET”. In dieser Ausgabe¬†ist auch mein sechsseitiger¬†Artikel¬†zur “Integration der Workflow Foundation in Microsoft Dynamics Nav” veröffentlicht. Der Artikel gibt einen Einblick in mögliche Kommunikationswege zwischen Microsoft Dynamics Nav und der Windows Workflow Foundation und zeigt die Integration beider Technologien anhand eines einfachen Workflow-Beispiels. Übrigens kann man das .NET-Magazin noch bis zum 15. Oktober ein Jahr lang zum halben Preis (38,25 ‚ā¨)¬†bestellen.

Tags: , ,