diff --git a/App.config b/App.config
index bae5d6d..ecdcf8a 100644
--- a/App.config
+++ b/App.config
@@ -1,6 +1,6 @@
-
+
diff --git a/CAMOsoft/CAMOsoft.DbUtils/CAMOsoft.DbUtils.csproj b/CAMOsoft/CAMOsoft.DbUtils/CAMOsoft.DbUtils.csproj
index 73d61f6..bf6d47e 100644
--- a/CAMOsoft/CAMOsoft.DbUtils/CAMOsoft.DbUtils.csproj
+++ b/CAMOsoft/CAMOsoft.DbUtils/CAMOsoft.DbUtils.csproj
@@ -10,7 +10,7 @@
Properties
CAMOsoft.DbUtils
CAMOsoft.DbUtils
- v4.6.1
+ v4.7.2
512
@@ -85,8 +85,12 @@
+
+
+ ..\..\packages\Microsoft.SqlServer.Types.14.0.1016.290\lib\net40\Microsoft.SqlServer.Types.dll
+
@@ -109,4 +113,22 @@
true
+
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+
+
+
\ No newline at end of file
diff --git a/CAMOsoft/CAMOsoft.DbUtils/SqlServerTypes/Loader.cs b/CAMOsoft/CAMOsoft.DbUtils/SqlServerTypes/Loader.cs
new file mode 100644
index 0000000..ce606cf
--- /dev/null
+++ b/CAMOsoft/CAMOsoft.DbUtils/SqlServerTypes/Loader.cs
@@ -0,0 +1,45 @@
+using System;
+using System.IO;
+using System.Runtime.InteropServices;
+
+namespace SqlServerTypes
+{
+ ///
+ /// Utility methods related to CLR Types for SQL Server
+ ///
+ public class Utilities
+ {
+ [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
+ private static extern IntPtr LoadLibrary(string libname);
+
+ ///
+ /// Loads the required native assemblies for the current architecture (x86 or x64)
+ ///
+ ///
+ /// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications
+ /// and AppDomain.CurrentDomain.BaseDirectory for desktop applications.
+ ///
+ public static void LoadNativeAssemblies(string rootApplicationPath)
+ {
+ var nativeBinaryPath = IntPtr.Size > 4
+ ? Path.Combine(rootApplicationPath, @"SqlServerTypes\x64\")
+ : Path.Combine(rootApplicationPath, @"SqlServerTypes\x86\");
+
+ LoadNativeAssembly(nativeBinaryPath, "msvcr120.dll");
+ LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial140.dll");
+ }
+
+ private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName)
+ {
+ var path = Path.Combine(nativeBinaryPath, assemblyName);
+ var ptr = LoadLibrary(path);
+ if (ptr == IntPtr.Zero)
+ {
+ throw new Exception(string.Format(
+ "Error loading {0} (ErrorCode: {1})",
+ assemblyName,
+ Marshal.GetLastWin32Error()));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/CAMOsoft/CAMOsoft.DbUtils/SqlServerTypes/readme.htm b/CAMOsoft/CAMOsoft.DbUtils/SqlServerTypes/readme.htm
new file mode 100644
index 0000000..02d9ac8
--- /dev/null
+++ b/CAMOsoft/CAMOsoft.DbUtils/SqlServerTypes/readme.htm
@@ -0,0 +1,61 @@
+
+
+
+
Action required to load native assemblies
+
+ To deploy an application that uses spatial data types to a machine that does not have 'System CLR Types for SQL Server' installed you also need to deploy the native assembly SqlServerSpatial140.dll. Both x86 (32 bit) and x64 (64 bit) versions of this assembly have been added to your project under the SqlServerTypes\x86 and SqlServerTypes\x64 subdirectories. The native assembly msvcr120.dll is also included in case the C++ runtime is not installed.
+
+
+ You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture).
+
+
ASP.NET Web Sites
+
+ For ASP.NET Web Sites, add the following block of code to the code behind file of the Web Form where you have added Report Viewer Control:
+
+ Default.aspx.cs:
+
+ public partial class _Default : System.Web.UI.Page
+ {
+ static bool _isSqlTypesLoaded = false;
+
+ public _Default()
+ {
+ if (!_isSqlTypesLoaded)
+ {
+ SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~"));
+ _isSqlTypesLoaded = true;
+ }
+
+ }
+ }
+
+
+
ASP.NET Web Applications
+
+ For ASP.NET Web Applications, add the following line of code to the Application_Start method in Global.asax.cs:
+
SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));
+
+
Desktop Applications
+
+ For desktop applications, add the following line of code to run before any spatial operations are performed:
+
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
+
+
+
+
\ No newline at end of file
diff --git a/CAMOsoft/CAMOsoft.DbUtils/packages.config b/CAMOsoft/CAMOsoft.DbUtils/packages.config
new file mode 100644
index 0000000..94d3422
--- /dev/null
+++ b/CAMOsoft/CAMOsoft.DbUtils/packages.config
@@ -0,0 +1,4 @@
+
+