28.06.2007, 17:00 | #1 |
Участник
|
axaptapedia: .NET Integration
Источник: http://www.axaptapedia.com/.NET_Integration
============== Summary: /* Introduction */ ==Introduction== There are 2 different types of .NET Integration. First you may use .NET Assemblies inside Dynamics AX via CLR Interop. Second you can use X++ Code from outside by the .NET Business Connector. By Default you can use the System Namespace in your Application. System.Collection.SortedList list = new System.Collection.SortedList(); ; ==CLR Interop== If you're using Visual Studio create a new Class Library Project. Implement whatever you need. In the Project Properties you have to sign your Assembly. Only signed Assemblies can be used in Dynamics AX. Change the Build Type to Release and build your Project. You find your DLL in your Projects bin/Release folder. Copy the DLL to the Dynamics AX Client/Bin Directory or register the Assembly in the Global Assembly Cache. Use the gacutil tool to register your Assembly in the GAC. gacutil /i yourlibrary.dll Open the AOT in your Dynamics AX Client. Add your Assembly to the References Node. If you have registered the Assembly in the GAC you can choose it from the grid. Otherwise you have to provide the path. If you don't get any errors it should work. It is a good idea to use Code Access Permissions with CLR Interop. Otherwise you will get a Best Practice Warning CodeAccessPermission permission; MyLibrary.MyClass foo; ; permission = new InteropPermission(InteropKind::CLRInterop); permission.assert(); foo = new MyLibrary.MyClass(); ==.NET Business Connector== The Business Connector is inverse to CRL Interop. It allows you to use Dynamcis AX Objects outside Dynamics AX. Typically scenarios are Load Testing using the Load Test Tool and Webservices. First you need to configure the Business Connector with the Client Configuration Tool. Next you have to provide a Proxy User. Create a new User Account in Active Directory. The Proxy User should be in the Administrator Group. In Dynamics AX you have to configure the Proxy User under Configuration > Security > BC Proxy User. Provide Username and Domain. Time to test the Business Connector; Start Visual Studio and create a new Console Application. Add the Reference to the Microsoft Business Connector .NET DLL . You find the DLL in the Client/Bin Directory. Try to connect with Dynamcis: try { Axapta axapta = new Axapta(); axapta.Login("","","",""); Console.WriteLine("It works"); axapta.Logout(); } catch(Exception ex) { Console.WriteLine(ex.ToString()); } Console.ReadKey(); If you are using the Business Connector in a Web Application you have to use the LogonAs Method try { System.Net.NetworkCredential credential = new System.Net.NetworkCredential("BCProxyUser","pass123","mydomain"); Axapta axapta = new Axapta() axapta.LogonAs("BCProxyUser","mydomain",credential,"","","",""); .. axapta.Logoff(); } [[Category:General development]] Источник: http://www.axaptapedia.com/.NET_Integration
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|