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 errorsOne must either use the fully-qualified name of a .Net type, method or event or have previously executed an appropriate using statementThere are often dependencies among .Net assemblies, e.g. Microsoft.SqlServer.Types requires a reference to System.DataMicrosoft.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 '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 '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.

Thanks Joe.The line I tried with CSE came straight from a VS2012 project. If the new keyword is unnecessary with CSE, so be it (not the end of the world!). Thus, it appears that you can work with the geography data type inside APL+Win. I'll resume my efforts in this direction.

Check out the intellisense or the Object Explorer in Visual Studio for the .Point() method to see that it is not a constructor, but a method.Not all sample projects available on line work - did you try the sample project in Visual Studio?

[NO, the coordinates have NOT been reversed - a really irritating 'feature' of Microsoft.]You refer to sample projects: could you give me a specific URL? Thanks.

The geography functions in SQL Server 2008 R2 or later are very powerful; and CSE enables APL+Win to work with two further (already had DateTime) strongly data types namely geometry and geography.

In C#, I have two ways to tap into the geospatial functionality: the first is by reference to a library (as above) and the second is by using EntityFramework.6.1.0. How Do I do use the entity framework with CSE?

I don't have a sample - I was asking you which sample you started with, because Point() is a method not a constructor.I have used entity framework from Visual Studio, but not from the CSE.In Visual Studio, the main benefit of entity framework is the database 'design surface'.That won't be available in the CSE, because it exclusive to Visual Studio's GUI.I will make some experiments to see what parts of entity framework would be accessible in the CSE.

I started by researching for 3 things that interested me (all implemented in SQL Sever 2000 functions using trigonometric functions & which are very slow), namely, distance between two points, is a point inside a multi-vertex polygon, and do two polygons intersect.

The examples I found were of variable quality, relating to SQL Server 2008R2 & SQL Server 2012. However, taken together, the examples provided me with a reasonable start; thereafter, as I became familiar with the jargon, searches became much more productive.

My preliminary research into using the Entity Framework with the CSE is based on the four Microsoft videos available from http://msdn.microsoft.com/en-us/data/ee712907.Some of the features of Entity Framework depend on NuGet and Visual Studio.I will try to provide some examples using Entity Framework in the next version of the CSE documentation.