I just need to figure what architecture is need to run ax functions from sql.
I didn't know what architecture, and I needed some clues how doing above - If there are any better solutions than mine, I would like to know.
Since I succeed doing the above, problem is solved.
OK. I succeed running the function (finally) in sql server. doing
sp_configure 'clr enabled', 1 ... etc.
I couldn't deploy, and since deployment is just copy of the dlls, what I did:
1. Put the dll in the assembly of sql server.
2. Create a function like : create function testx()
RETURNS int
as
EXTERNAL NAME SqlServerProject1.UserDefinedFunctions.testx
(external name is the dll+class+function).
And use it.
3. For AX - I need to add interopted class and some classes, and I cannot put on server any dll (that's not work and many exception, such as:
...
CREATE ASSEMBLY for assembly 'Microsoft.Dynamics.AX.ManagedInterop' failed because assembly 'Microsoft.Dynamics.AX.ManagedInterop' is malformed or not a pure .NET assembly.
Unverifiable PE Header/native stub. (Microsoft SQL Server, Error: 6544)
...
4. So, I have checked ability running a web site (local server), and this was without problem.
5. Since I know how using Rest-API, I can use that as an architecture and all the business logic will be on the AOS server (which I can run any function from ax) and getting i.e a json string etc - don't know whether this is the best approach, but it definitely solve the problem of running any ax-function from sql server.
(Architecture that I have thought about is to put REST-API on the AOS server.
Call the REST-API from user defined function - put that function on the server as mentioned.
In the rest-api function do function like callaxfunc(type, objectname, methodname, parameters...).
All are internal servers I can use inside the organization - nothing is outside).
Thanks, anyway :)