Dynamics AX
  RSS Feed  LinkedIn  Twitter
Want to turn you're data into a true asset? Ready to break free from the report factory?
Ready to gain true insights that are action focused for truly data informed decisions?
Want to do all of this across mutliple companies, instances of Dynamics and your other investments?
Hillstar Business Intelligence is the answer then! (www.HillstarBI.com)

Hillstar Business Intelligence for Microsoft Dynamics AX and NAV on Mobile, Desktop, Tablet


Let us prove to you how we can take the complexity out of the schema and truly enable users to answer the needed questions to run your business! Visit Hillstar Business Solutions at: www.HillstarBI.com

Monday, August 15, 2011

Microsoft Dynamics AX 2012 - A Dive into Services, Custom Services (Part II)



I wanted to continue today, with my dive into services, for Microsoft Dynamics AX 2012, where I left of with Microsoft Dynamics AX 2012 - A Dive into Services, Custom Services (Part I).

Today's focus for this area, will be around DataContracts, a look into a simple one, as well as working with collections through SysEntryPoint methods, or Operations of service contracts, for DataContracts.

With that, we left of in Part I, with the showing the basic parts that make up a given custom service. This includes: an X++/Xpp class, that represents the logic of exposed business logic through SysEntryPoint tagged methods. Then we have a service node, that is tied to said class, with the ability to turn SysEntryPoint methods into operations. Finally we have a Service Group node, that the new custom service resides in, as a publishing point so the service can be consumed.

Now that we have this base understanding, lets look at what we would most likely be making use of, through such SysEntryPoint service operations.

When you think of Services, and specifically WCF services, then you start to also think in terms of DataContracts. This did not exists prior to AX 2012, however has been a major part and concept of WCF, since WCF was introduced back in .Net 3.0 days.

It's a similar concept, in that the point of a DataContract is what the name implies, to offer a Contract, with set Properties or Attributes, that govern the interaction of the consumer and the service, for exchanging data. Mouth full huh?

So lets look at what enables a basic DataContract. First, a DataContract is an X++ class. Like the SysEntryPoint metadata tag for service operations, there are several metadata tags that enable a DataContract to exists. These metadata tags, or attribute tags define to AX what the purpose and point of a class, and it's methods are meant to be.

In turn AX 2012 can use this information, when the times comes to generate the Artifacts that enable the usage of said elements.

So lets look at a simple example. What we will do is create a DataContract class, and set that is has two Attributes or Properties, Name, Account. To do this, we need to create a new class, and within the Class declaration add DataContractAttribute metadata tag, as shown below.



Simply adding that given tag, will now enable this class to be used as a DataContract within AX 2012 and outside of AX 2012, when being exposed as part of a Service Operation.

Since we need to attributes, lets now take and add two class scope, private variables to the class declaration of our new DataContract.



Now that we have our class context, private Str variables, we can reference these in creating our attributes for the DataContract, as shown below.





You will notice that for each of these, we have to declare the give methods as DataMemberAttribute, so that for the given generation of the WCF Artifacts and WSDL, AX can know which methods on the DataContract are meant to act as such, and which are not.

On this same topic, you will also notice I supplied the Name, and Account in text as part of the DataMemberAttribute tag. The reason I do this, is so that those consumes outside of AX will see these as properties of the DataContract as Name and Account, vs. parmName and parmAccount.

Since properties don't exist in AX, we make use of the parm method concept that you see in the above pictures.

Now looking at our class from a higher level, we see that we declared the given element as a DataContractAttribute at it's class declaration, and then each property or DataMemberAttribute is declared using the parm Method concept.



That's It! Now you have a DataContract that can be used within a given AX Service Operation.

Lets do exactly that, with taking and creating a Service class, a SysEntryPoint that will represent an operation, and have it to where the DataContract is the required parameter of the method signature.



Now, if we took and deployed this as a service, contained within a service group, we would have a service operation called doWork that would require us to pass in the idbDataContract to operate off of.

That's pretty straight forward and easy huh? What about working with a collection, say a List of DataContracts? Now that is not as well documented yet, however very possible. This is enabled through the use of the AifCollectionTypeAttribute, as shown below.



Now, first thing you should notice is that we can have multiple metadata attributes applied to a given method, using , (commas) to separate the attribute tags. Next this AifCollectionTypeAttribute is an animal of it's own, lets me say that.

So what we are doing here is declaring the Parameter Name that will be used as part of this collection. Second, we are declaring the type of the parameter, which happens to be a class and finally we are telling AX what will live in this list, which happens to be our idbDataContract we created earlier.



The idea that this whole AifCollectionTypeAttribute enables, is because of the fact that X++ is not a strongly typed language, however when working with collections we have to give a strongly type collection. This is what we are doing when we work with the AifCollectionTypeAttribute. We are giving the generator of the artifacts a way to describe and create for use by external consumers, to interact with collection types, from X++.

So there you go, we now know how to take and create a basic custom service, a data contract and work with a collection of data contracts within AX and to expose that to the outside world.

My part of this series, I will show how these are called from within AX and outside of AX, and look at the differences and some other important supporting information in this area.

I hope you can see too, that this is the build up that we first touch upon as the vision some years ago in this post, Microsoft's strategy and vision for Dynamics AX and SOA, and one that we have been covering ever since.

That's all for now, check back soon as more to come! Till Next time!



"Visit the Dynamics AX Community Page today!"


Labels: , , , , , , , , , ,

Tuesday, August 02, 2011

Microsoft Dynamics AX 2012 - A Dive into System Services, Metadata Service



Recently I wrote last week about Microsoft Dynamics AX 2012, talking about a dive into Services.

One of the area's that I covered in this post was around System Services. To recap:
"System Services are meant to give a window into the Dynamics AX 2012 world. Part of that world involves Query Service, as well as the Metadata Service. These two services are meant to be very specific uses. The Query Service is meant to take and offer an ad-hoc ability to query datasets, from AX 2012."

With this initial post as our guide, lets take and step through these different area's of services, get some real examples, and talk about what kind of value each type can bring to an implementation.

System services, are new in AX 2012, and so their value will develop overtime, and more and more people find ways to make use of them, to drive value. The Query service is meant, as stated, to give the ability to have an ad-hoc nature to query data from an AX 2012 instance. I don't actually recommend using this that much, as we get into Document Services in a later post, and see that most all data access should take place, starting with a query object inside Dynamics AX 2012.

With that said, lets focus our time for this post, on the Metadata service. To start, the system services are auto deployed out of the box, and so there is nothing that you have to do, in other than make a reference to the given Metadata service's WSDL.

To do that, the following is the format for accessing the metadata service.: http://servername:port/DynamicsAx/Services/MetadataService

This, if placed in a web broswer, will bring back the WSDL for this given service, which is true for any service, or service group I should say. You will notice that this is how you make a reference, from say Visual Studio 2010.

In doing so, and if you look at the app.config file from within your project, you will notice though, that the binding is actually net.tcp//. This is because these system services are hosted, out-of-the-box, within the AOS itself. More in a later post on options for hosting services.

Example app.config


You will notice, in the above example app.config file, that I have changed the maxBufferSize and the maxReceivedMessageSize. The reason this is the case, is because my example, with getting metadata about a given table, pulls back a larger resultset than the default settings for this WCF net.tcp binding is configured to receive. If you don't do this, the first time you use the Metadata service, it will error out. Keep in mind, this is WCF we are dealing with, and though it's gotten a lot easier to deal with bindings and settings, it's still something that must be done.

Now that we have our reference within our Visual Studio 2010 project, lets take and dive into working with it.

For our example, lets create some unit of code, that will take and call the metadata service, and in turn ask for metadata about a specific table. The following is the C# code for doing just that.:


For reference, and being able to search with google or bing, the following is that code in plain text:
"Ax2012MetadataService.AxMetadataServiceClient cl =
new Ax2012MetadataService.AxMetadataServiceClient();

cl.Open();

string[] axTableNames = new string[1];
axTableNames[0] = "CustTable";

Ax2012MetadataService.TableMetadata[] axTableMetaData =
cl.GetTableMetadataByName(axTableNames);

MessageBox.Show("Title Field1: " + axTableMetaData[0].TitleField1.Name +
", Title Field2: " + axTableMetaData[0].TitleField2.Name);

cl.Close();"


Now what we have here is straight forward, I'm taking and creating an instance of the AX2012MetadataServiceClient which was generated for me by VS2010, when adding the service reference to the project.

After that, I open the given client object, and fill a string[] array with a single entry, for the "CustTable". After doing this, I take and fill a TableMetadata[] array, which is part of the WSDL DataContracts supplied from AX 2012, with calling the client and a .GetTableMetadataByName(axTableNames) and pass it my string array of tables that only contains, for this example, the CustTable.

After this, I'm able to simply call a message box, and show the Title Fields 1 & 2, that are supplied by AX 2012, and passed back within that TableMetaData[] array.

The result is as follows.:


As you can see, we get back the Title Field information, and really we can get back anything that is contained within the properties of a given table object, which is the metadata for this given type of object.

This is the same for classes, EDT's, enums, forms, etc. etc. This is actually a pretty powerful class, as you can start to see uses of this new service, for given the ability of AX 2012 to describe itself to other LOB applications, as with the correct rights, you can get a list of tables, and then from those tables, a list of every field within those tables, and there EDT's or base enums, and then information about every single one of those.

One thing I will add, is that I have noticed the Autoreports, that run from File > Print > Print for a given form, actually make use of the MetadataService for fulfilling part of it's needs for generating the autoreports in AX 2012. So that is a solid use, of this new offering.

As me move into AX 2012, which was released as GA in 25 countries yesterday, see: Drum Roll Please… Microsoft Dynamics AX 2012 is now on the market!, we will start to see uses of these system services that help enable, extend and the bottom line, drive business value for customers that make use of this great new ERP platform.

Well that's all for now, but check back soon as a whole lot more to come! Till next time!



"Visit the Dynamics AX Community Page today!"

Labels: , , , , , , , , , ,

Monday, January 10, 2011

Official Details about Dynamics AX '6' released, including comments from Microsofts Kees Hertogh

Here we are, kicking off 2011 with a bang for Microsoft Dynamics AX! Next week in the Microsoft Dynamics AX 2011 Technical Conference, in which the primary focus in on Microsoft Dynamics AX '6'.

To kick things off, Microsoft today did a press release, in which official details about the Microsoft Dynamics AX '6' product was released. A direct link to the Press Release can be found here.: Microsoft Previews Next-Generation ERP

This press release was well covered by both MSDynamicsWorld.com, here: Microsoft Confirms Details of Upcoming Dynamics AX "6" Version, as well as MaryJo Over at ZDNet, on her 'All About Microsoft' blog, found here.: 2011 to be a big year for Microsoft in ERP


In reading the press release, and extra coverage, I had to many questions that I wanted to get more details about, for the AX '6' news that was released today. So Kees Hertogh, Director, Product Management, Microsoft Dynamics AX agreed to do a phone interview with me.

Below is the result of that interview.:



Q: Kees, one of the highlighted features of AX '6' is the unique model-driven, layered architecture. However this already exists in Microsoft Dynamics AX 2009. Can you share more details about how Dynamics AX '6' improves this area?

Kees: It is true that the layered concept already exists in Microsoft Dynamics AX 2009. However there have been a lot of improvements in this area for AX '6'.

One of the biggest improvements, is around enabling ISV solutions to be installed into the same layer, without issue. Before, even with Microsoft Dynamics AX 2009, one would have to manually compare the code from two ISV solutions, then import, 'fixing' the objects so they could work together in the same layer. Now with Microsoft Dynamics AX '6' that is no longer a need.

The model-driven development aspect somewhat exist in Microsoft Dynamics AX 2009, however we have really improved on this, as you and I have talked before. (see: Interview with Microsoft's Kees Hertogh)

With moving the application code, and meta-data of the objects to a SQL Server Database, this opens a whole new world for developers and customers with Dynamics AX '6' around model driven development.

For example, now with a single click, web forms can be generated from rich client forms, with no extra coding needed. This, along with other things will be shown during the keynote of next weeks Dynamics AX 2011 Technical Conference.


Q: Kees, the second listed bullet in the press release, focuses around Microsoft Dynamics AX '6' Pre-built interoperability with products like Office 2010, SharePoint 2010 & Visual 2010. This too though, actually exists 'technically' with Microsoft Dynamics AX 2009. Can you shed some light on how Dynamics AX '6' improves or offers more in this area?


Kees: For us this is a big area of improvement actually. It is true, that at the server level, and some at the client level, Microsoft Dynamics AX 2009 has interoperability with the above mentioned products. However, not at the level you are going to see next week at the Dynamics AX 2011 Technical Conference.

You see a lot of our compotiers, for example, need middleware to ineract with products like Microsoft Office 2010. This is true at the server and client level. What we have done with Microsoft Dynamics AX '6', is get rid of the need for any such middleware, ineractions through COM, etc.

So for the client interop, we are blurring the lines between Microsoft Dynamics AX '6' client, and Office 2010. By this, I mean for the user experience level. Making the UI's more similar, having functionality within Office, that can more natively interact with Dynamics AX '6' out of the box. This does not mean that Office 2010 can replace the Rich Client of Dynamics AX '6'. However it does mean, that for the user, that loves to Excel - which happens to be the most widely used piece of software in the world - then that seemless experience will now exists, with having to do nothing more than install Dynamics AX '6' and Office 2010.

For developers, a lot of time is typically spent on getting the right hooks, and defined interactions to take place, in order to have this kind of interop we will now be offering with Dynamics AX '6' and Microsoft Office 2010. These kinds of efforts will save developers a lot of time, when customizing and developing solutions for Microsoft Dynamics AX '6' that include Office 2010 and the other Microsoft product stack offerings.

There are also big improvements, for example around Dynamcis AX and SSRS. For more native development, and features that come as part of SSRS, to work more natively, with less headache and setup issues that we have seen before.

These are just two examples, that you will see, along with others at the Tech Conference next week. It's important to note, that this is how we look at interoperability. Both Server and Client. As well as End User and Developer.


Q: Kees, you have mentioned several times in the interview about next weeks Tech Conference, and I know I have been talking about it since last Sept. What do you see as the 'big picture' take away for next week?


Kees: Next weeks Technical Conference should not be seen as a goal, or an end point. It should not be a conference you go to, and then just walk away. It just be viewed as a jump start to you and your companies ramp up plan for Microsoft Dynamics AX '6' release in Q3.

There will be a lot of coverage, with all kinds of great sessions, topics, etc. However, one should walk away and have viewed the conference as the starting point to build their own ramp up for AX '6' with.

This goes for the developer, the implementer and the customer. It's very important that everyone who attends, and is serious about Microsoft Dynamics AX '6' do their homework, and walk away from the conference with a sense of direction for creating their own plans for training, and knowledge sharing within their own companies.


Well once again, I would like to thank Microsoft, and Kees for taking the time to allow me to virtually sit down and pick his brain. I will be attending next weeks, conference - as long as the 7 inches of ice and snow melts away that is currently around me. (Yes that much in Alabama! Roll Ice Roll I guess?)

We have a lot to look forward too next week, and I will be covering the event from my twitter account and this blog.

That's all for now, check back soon as I have a new guest blogger, with his first column appearing at the end of this week. See you then!

Also, for those who are not familiar with Kees Hertogh, below is his bio.:
Kees Hertogh is a director for Microsoft Business Solutions (MBS). He leads the Microsoft Dynamics AX Global Product Management team. In his current role, Hertogh is responsible for developing and driving global product strategy for Microsoft Dynamics AX.

In 1999, Hertogh joined Navision a/s, which was later acquired by Microsoft Corp. Before leading the product management for Microsoft Dynamics AX, he worked in the Microsoft Business Solutions marketing strategy group as director of the group’s competitive strategy, and before that he was a group product manager on Project Green. Before joining Microsoft, he held the position of product director on the MBS management team at Microsoft Netherlands, and was responsible for local product strategy and the local product management and development teams.

Hertogh has a bachelor’s degree in business administration with a focus on management accounting from Haarlem Business School in the Netherlands. He also achieved Certified in Production and Inventory Management (CPIM) status from the Association for Operations Management (APICS).


"Visit the Dynamics AX Community Page today!"

Labels: , , , , , , , , , ,

Wednesday, November 11, 2009

Reflection - Where and why

With Dynamics AX, the ability to make use of Reflection, or Reflective Programming, exist.

For those that don't quite understand what reflection is, please check out the following wikipedia link, which explains it well.:
Wikipedia.org Link



As described on the wikipdeia article.:
"In computer science, reflection is the process by which a computer program can observe and modify its own structure and behavior. The programming paradigm driven by reflection is called reflective programming. It is a particular kind of metaprogramming.

In many computer architectures, program instructions are stored as data - hence the distinction between instruction and data is merely a matter of how the information is treated by the computer and programming language. Normally, instructions are executed and data is processed; however, in some languages, programs can also treat instructions as data and therefore make reflective modifications. Reflection is most commonly used in high-level virtual machine programming languages."


So the idea of reflection, or meta-programming, has actually been around for a long while. Since the mid 1980's. And the ability to perform reflective programming exists in many langauges, including C#, Java, and X++.

There are plenty of examples actually of reflection, that are common use with Dynamics AX. These may not be considered full reflective based programming, but aspects of this exists all through the common code base of Dynamics AX.

Take for example the Common object. All tables actually extend from this Common object.

As it's base, you have then the ability to send a table of unknown type, and operate it on a method that does not know until runtime, what the Common object actually represents.

So there eixsts, for the Common object, the ability for it to describe itself to later executing code, and therefore can then be acted upon at runtime.

For example.:

public void SomeMethod(Common Rec)
{
Table1 tbl1var;
Table2 tbl2var;
;

switch(tableid2name(rec.tableid))
{
case "Table1" :
tbl1var = Rec;
break;

case "Table2" :
tbl2var = Rec;
break;
}

// Do some code here on the Tables...
}


In the above example we see a somewhat common approach for having a method find out what kind of table that is being passed in, and then operate on that table based on the table name.

Now if you expand this further, there are other classes, and objects that exists inside Dynamics AX that help us really implement Reflection.

These classes include.:

  • SysDictTable

  • SysDictField

  • SysDictClass

  • Etc.



You can browse the AOT, Classes and go to SysDict* and see what all exists there.

The reason I bring reflection up, is I think it's not a well understood topic, and one that if more people understood could really benefit from.

I have done some development work before, that making use of reflection could read an entire SQL Server databse, read in datatypes, field lengths, tables names, and use that to create tables, extended data types, and import the data into these new tables, with a single object.

There is also possibilities for making use of reflection for say you want to have a class framework, and have a class tied to a given customer to operate some kind of acknowledgement to that customer.

You don't however want to have a mega object that operates all this for you, and you want flexibility. What to do?

Well you can make use of reflection, to create a framework that will execute code, not knowing for sure what it's executing actually. Only knowing that the given class it is executing has a specific method. And you made sure of that this method exists, because you make use of reflection to see if it actually does exists.

This can be done with making use of the SysDictClass, and the Object, Object. You could also get fancy, if need be, and create code at run time, compile that code and run time, execute that code at run time, and have that code return it's output to operate on. Again, All at run time!

To see a decent example of this, check the following out.: Generating and running code RUNTIME

Also, a great resource on this very matter, with X++ as the focus is the SysDictCoder blog, found here.: SysDictCoder Blog

The following are just some of the great highlights that have been from this blog, and I myself have made use of most or not all of these in my lifetime of AX.:


Those are just some recent few actually, and there is a lot more.

The whole idea of reflective development, making use of reflection is smart coding. Sometimes people look at it as code that makes code. If I can create a single object that saves me time from coding 200 objects, that that is the better way.

And that last example, true example. Not a made up number. I have done this before, specifically relating to data imports.

That's all for now, I hope this is enough to get you thinking about reflection, some of it's common uses in X++, and maybe how it can help you solve that next need.

Till next time!




"Visit the Dynamics AX Community Page today!"


Labels: , , , , , , , , , , , ,

Monday, May 04, 2009

MFP: AX6 sneak preview - SQL AOD

Well MFP is giving us a sneak preview into AX 6.0 milestone. The AOD files are 'a changing'.

Check out the post here: MFP Blog Post: 'AX6 sneak preview - SQL AOD'

From the post:
"Today we built the first official build of Dynamics AX ever that does not run on AOD files. Starting today Dynamics AX's model database is stored in a Microsoft SQL Server database."

That's right, the Model Database will now be in a SQL Server Database.

More from the post:
"So far we have aimed at providing 1-to-1 parity with AOD files; but the potential of this is amazing - I hardly know where to start...

-Performance can be further improved as the subsystems querying the meta data store starts levarging the powers of SQL. For example; the ISAM database used for the AOD files (and still used by temp tables) doesn't support joins. Due to this many subsystems are overly chatty when reading meta data as they query row-by-row.

-Solving the element ID problem is now possible, as we can leverage the flexibilty and powers in SQL for modifying and extending the model schema.

-Capabilities... There are so many cool scenarios we can enable - but you'll have to wait for an sneak preview after the next milestone to learn more. But to get you thinking: What deployment capabilties did AOD files lack?"


My gears are already turning on how much better this will make the overall performance of the entire system work. True indexed model data, speed at the SQL level, this is for sure the right move.

I can't wait to hear more, thanks MFP for sharing and getting this out there.




"Visit the Dynamics AX Community Page today!"


Labels: , , , , , , , ,


Copyright 2005-2011, J. Brandon George - All rights Reserved