Hi Ajay,
Thank you for asking this question.
I think that my answer will be instructive to others interested in using the APLNext C# Script Engine in APL+Win.
The problem you are having has nothing to do with APL+Win or the APLNext C# Script Engine,
APL+Win and the CSE can utilize
properly designed C# executable statements and effectively use the .Net SqlGeography type.
Probably the most difficult part for an APL+Win programmer using C# is interpretation of the C# compiler errors.
Of course the reverse would be true for a C# programmer using APL+Win and trying to interpret the APL+Win exception messages (quad-DM).
Step-by-step, I will provide corrections to your C# executable statements, but here are few highlights:
When the CSE 'ExecStmt' method returns -1, use the CSE 'GetLastError' to obtain the C# compiler error or alternately, set the CSE 'returnonerror' property to 1 to generate APL+Win exceptions for C# compiler errors
One must either use the fully-qualified name of a .Net type, method or event or have previously executed an appropriate using statement
There are often dependencies among .Net assemblies, e.g. Microsoft.SqlServer.Types requires a reference to System.Data
Microsoft.SqlServer.Types.Point() is a method and not a constructor, so the 'new' prefix to Microsoft.SqlServer.Types.Point(...) is not correct
⎕cself←'C'⎕cse 'Init' 'System'
⍝↑ Successfully create an instance of the APLNext CSE called 'C' in the APL+Win session
⎕cse 'ExecStmt' 'using System;'
0
⍝↑ Successfully add a using statement to make all of the System namespace available without specifying the prefix 'System.', e.g. 'Int32' instead of '
⎕cse 'LoadAssembly' 'C:\Program Files\Microsoft SQL Server\110\Shared\Microsoft.SqlServer.Types.dll'
Name=Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=, PublicKey token=89-84-5D-CD-80-80-CC-91
⍝↑ Successfully load the Microsoft .Net assembly containing the .Net SqlGeography type
⎕cse 'ExecStmt' 'SqlGeography thisPoint1 = new Microsoft.SqlServer.Types.SqlGeography.Point(12.34, 56.677, 4326);'
¯1
⍝↑ Fail in the attempt to create an instance of the SqlGeography type
⎕cse 'GetLastError'
(1,1): error CS0246: The type or namespace name 'SqlGeography' could not be found (are you missing a using directive or an assembly reference?)
⍝↑ Successfully obtain the C# compiler error reported
⎕cse 'ExecStmt' 'Microsoft.SqlServer.Types.SqlGeography thisPoint1 = new Microsoft.SqlServer.Types.SqlGeography.Point(12.34, 56.677, 4326);'
¯1
⍝↑ Fail in the attempt to correct the prior statement by adding the fully-qualified name of the SqlGeography type to the left side of the equals sign in the C# executable statement.
⎕cse 'GetLastError'
(1,27): error CS0012: The type 'System.Data.SqlTypes.INullable' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
⍝↑ Successfully obtain the C# compiler error reported
⎕cse 'LoadAssemblyByName' 'System.Data'
Name=System.Data, Version=4.0.0.0, Culture=, PublicKey token=B7-7A-5C-56-19-34-E0-89
⍝↑ Successfully load from the Global Assembly Cache (GAC) the Microsoft .Net System.Data assembly
⎕cse 'ExecStmt' 'Microsoft.SqlServer.Types.SqlGeography thisPoint1 = new Microsoft.SqlServer.Types.SqlGeography.Point(12.34, 56.677, 4326);'
¯1
⍝↑ Fail in the attempt to create an instance of the SqlGeography type
⎕cse 'GetLastError'
(1,96): error CS0426: The type name 'Point' does not exist in the type 'Microsoft.SqlServer.Types.SqlGeography'
⍝↑ Successfully obtain the C# compiler error reported
⎕cse 'ExecStmt' 'Microsoft.SqlServer.Types.SqlGeography thisPoint1 = Microsoft.SqlServer.Types.SqlGeography.Point(12.34, 56.677, 4326);'
0
⍝↑ Successfully create the instance of the SqlGeography type using SqlGeography.Point() which is a method not a constructor, so the 'new' prefix is not appropriate.