From 7ce89a36209ab6e2c40f2763ded931ad95ef0bb6 Mon Sep 17 00:00:00 2001 From: Felix Obermaier Date: Mon, 15 Mar 2021 15:21:49 +0100 Subject: [PATCH] Fix EF6 Project --- src/SharpMap.BusinessObjects.EF6/App.config | 22 ------- .../SharpMap.BusinessObjects.EF6.csproj | 59 ++++++++++++++----- .../SqlServerTypes/Loader.cs | 45 -------------- .../SqlServerTypes/readme.htm | 39 ------------ .../packages.config | 14 ----- 5 files changed, 44 insertions(+), 135 deletions(-) delete mode 100644 src/SharpMap.BusinessObjects.EF6/App.config delete mode 100644 src/SharpMap.BusinessObjects.EF6/SqlServerTypes/Loader.cs delete mode 100644 src/SharpMap.BusinessObjects.EF6/SqlServerTypes/readme.htm delete mode 100644 src/SharpMap.BusinessObjects.EF6/packages.config diff --git a/src/SharpMap.BusinessObjects.EF6/App.config b/src/SharpMap.BusinessObjects.EF6/App.config deleted file mode 100644 index f542715..0000000 --- a/src/SharpMap.BusinessObjects.EF6/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - -
- - - - - - - - - - - - - - - - - diff --git a/src/SharpMap.BusinessObjects.EF6/SharpMap.BusinessObjects.EF6.csproj b/src/SharpMap.BusinessObjects.EF6/SharpMap.BusinessObjects.EF6.csproj index 1d71c69..06250ae 100644 --- a/src/SharpMap.BusinessObjects.EF6/SharpMap.BusinessObjects.EF6.csproj +++ b/src/SharpMap.BusinessObjects.EF6/SharpMap.BusinessObjects.EF6.csproj @@ -1,20 +1,49 @@ - + - - net472 - SharpMap.BusinessObjects.EF6 - SharpMap GIS Map GeoSpatial Business EF6 - SharpMap - EF6 business objects to work with SharpMap - true - + + net472 + SharpMap.BusinessObjects.EF6 + SharpMap GIS Map GeoSpatial Business EF6 + SharpMap + EF6 business objects to work with SharpMap + true + - - - + + + + - - - + + + + + + + SqlServerTypes\Loader.cs + + + + + + SqlServerTypes\readme.htm + + + SqlServerTypes\x64\msvcr120.dll + PreserveNewest + + + SqlServerTypes\x64\SqlServerSpatial140.dll + PreserveNewest + + + SqlServerTypes\x86\msvcr120.dll + PreserveNewest + + + SqlServerTypes\x86\SqlServerSpatial140.dll + PreserveNewest + + diff --git a/src/SharpMap.BusinessObjects.EF6/SqlServerTypes/Loader.cs b/src/SharpMap.BusinessObjects.EF6/SqlServerTypes/Loader.cs deleted file mode 100644 index 0dc61f6..0000000 --- a/src/SharpMap.BusinessObjects.EF6/SqlServerTypes/Loader.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace SqlServerTypes -{ - /// - /// Utility methods related to CLR Types for SQL Server - /// - internal 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, "msvcr100.dll"); - LoadNativeAssembly(nativeBinaryPath, "SqlServerSpatial110.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/src/SharpMap.BusinessObjects.EF6/SqlServerTypes/readme.htm b/src/SharpMap.BusinessObjects.EF6/SqlServerTypes/readme.htm deleted file mode 100644 index 0f9eade..0000000 --- a/src/SharpMap.BusinessObjects.EF6/SqlServerTypes/readme.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - Microsoft.SqlServer.Types - - - -
-

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 SqlServerSpatial110.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 msvcr100.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 applications

-

- For ASP.NET 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/src/SharpMap.BusinessObjects.EF6/packages.config b/src/SharpMap.BusinessObjects.EF6/packages.config deleted file mode 100644 index a195f81..0000000 --- a/src/SharpMap.BusinessObjects.EF6/packages.config +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file