20.05.2011, 11:11 | #1 |
Участник
|
X++: X++ script host.
Источник: http://blogs.msdn.com/b/x/archive/20...ript-host.aspx
============== I was looking at the API that we publish for the X++ compiler, and it struck me that it would be really easy to implement a script host for X++. This is a program that allows you to execute arbitrary X++ code that is stored in files in the file system. In this way, you can use X++ as a systems programming language, starting things at particular times etc. I thought it would be fun to see what it takes to implement that command line tool. In the spirit of sharing, I am listing the C# code below. It is, after all, only just over 100 lines of code. Let's imagine that we have a file called MyFile.xpp containing the following: PHP код:
C\> XppScriptHost MyFile.xpp 3 3.141 "I am an argument". The script host will return a code to the operating system, so that decisions can be made in script files etc. You could even register the file type (Xpp in this case) with the operating system, so that clicking on the xpp file will automatically start the script (but you will not be able to pass parameters). This is really easy in Windows: You just right click in the .xpp file, and the system will ask you to identify the program to use to open the file. Select this tool and you're in business. There is certainly room for improvement to this: You could introduce parameters for each of the four arguments passed to the logon call if that is useful in your scenarios. I did not do so here for the sake of simplicity. Since the business connector is compiled against an earlier version of .NET (to be compatible with the sharepoint pieces), you will need to tell the command line tool that it is should support the earlier framework. You cannot use .NET 2, because the LINQ stuff in the code would not run in that case. Feel free to rewrite that if you must. I just use a configuration file (app.Config) with the following content: PHP код:
PHP код:
Источник: http://blogs.msdn.com/b/x/archive/20...ript-host.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. Последний раз редактировалось Poleax; 20.05.2011 в 13:07. Причина: оформление |
|
22.06.2020, 15:13 | #2 |
Участник
|
Э-э-э-э... Серьезно? Так можно было?
|
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|