update dei datatypes SQL...

This commit is contained in:
Samuele E. Locatelli
2017-01-24 12:43:52 +01:00
parent 60cf738ed5
commit f4b2413200
27 changed files with 2 additions and 296 deletions
-22
View File
@@ -69,10 +69,6 @@
<HintPath>..\packages\Microsoft.ReportViewer.2015.Runtime.12.0.2.2402\lib\Microsoft.ReportViewer.WebForms.DLL</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.SqlServer.Types.11.0.2\lib\net20\Microsoft.SqlServer.Types.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
@@ -109,22 +105,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="..\packages\Microsoft.SqlServer.Types.11.0.2\nativeBinaries\x64\msvcr100.dll">
<Link>SqlServerTypes\x64\msvcr100.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\packages\Microsoft.SqlServer.Types.11.0.2\nativeBinaries\x64\SqlServerSpatial110.dll">
<Link>SqlServerTypes\x64\SqlServerSpatial110.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\packages\Microsoft.SqlServer.Types.11.0.2\nativeBinaries\x86\msvcr100.dll">
<Link>SqlServerTypes\x86\msvcr100.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\packages\Microsoft.SqlServer.Types.11.0.2\nativeBinaries\x86\SqlServerSpatial110.dll">
<Link>SqlServerTypes\x86\SqlServerSpatial110.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Accettazione.aspx" />
<Content Include="AccettazioneEdit.aspx" />
<Content Include="App_Readme\Elmah.txt" />
@@ -382,7 +362,6 @@
<Content Include="Scripts\jquery-2.2.4.min.js" />
<Content Include="Scripts\jquery.mobile-1.4.5.js" />
<Content Include="Scripts\jquery.mobile-1.4.5.min.js" />
<Content Include="SqlServerTypes\readme.htm" />
<Content Include="UserAdmin.aspx" />
<Content Include="VAC.aspx" />
<Content Include="VBMA.aspx" />
@@ -504,7 +483,6 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="SqlServerTypes\Loader.cs" />
<Compile Include="UserAdmin.aspx.cs">
<DependentUpon>UserAdmin.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
-45
View File
@@ -1,45 +0,0 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace SqlServerTypes
{
/// <summary>
/// Utility methods related to CLR Types for SQL Server
/// </summary>
internal class Utilities
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr LoadLibrary(string libname);
/// <summary>
/// Loads the required native assemblies for the current architecture (x86 or x64)
/// </summary>
/// <param name="rootApplicationPath">
/// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications
/// and AppDomain.CurrentDomain.BaseDirectory for desktop applications.
/// </param>
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()));
}
}
}
}
-39
View File
@@ -1,39 +0,0 @@
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>Microsoft.SqlServer.Types</title>
<style>
body {
background: #fff;
color: #505050;
margin: 20px;
}
#main {
background: #efefef;
padding: 5px 30px;
}
</style>
</head>
<body>
<div id="main">
<h1>Action required to load native assemblies</h1>
<p>
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.
</p>
<p>
You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture).
</p>
<h2>ASP.NET applications</h2>
<p>
For ASP.NET applications, add the following line of code to the Application_Start method in Global.asax.cs:
<pre> SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));</pre>
</p>
<h2>Desktop applications</h2>
<p>
For desktop applications, add the following line of code to run before any spatial operations are performed:
<pre> SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);</pre>
</p>
</div>
</body>
</html>
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -41,7 +41,7 @@
<add key="adminEmail" value="samuele@steamware.net" />
<add key="PageNoIndex" value="UserAdmin#Test" />
<!--gestione reports!-->
<add key="ReportBasePath" value="~\bin\Reports" />
<add key="ReportBasePath" value=".\bin\Reports" />
<!--stringhe connessione-->
<add key="ScheMeConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=ScheMe;Persist Security Info=True;User ID=sa;Password=keyhammer;" />
<add key="ScheMeFilesConnectionString" value="Data Source=SQL-STEAM\SQL2012;Initial Catalog=ScheMe_files;Persist Security Info=True;User ID=sa;Password=keyhammer;" />
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -11,7 +11,7 @@
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net45" />
<package id="Microsoft.ReportViewer.2015.Runtime" version="12.0.2.2402" targetFramework="net462" />
<package id="Microsoft.SqlServer.Types" version="11.0.2" targetFramework="net462" />
<package id="Microsoft.SqlServer.Types.Unofficial" version="12.0.2000.8" targetFramework="net462" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="MSBuild.Microsoft.VisualStudio.Web.targets" version="14.0.0.3" targetFramework="net462" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
Binary file not shown.
Binary file not shown.
@@ -1,45 +0,0 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace SqlServerTypes
{
/// <summary>
/// Utility methods related to CLR Types for SQL Server
/// </summary>
internal class Utilities
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr LoadLibrary(string libname);
/// <summary>
/// Loads the required native assemblies for the current architecture (x86 or x64)
/// </summary>
/// <param name="rootApplicationPath">
/// Root path of the current application. Use Server.MapPath(".") for ASP.NET applications
/// and AppDomain.CurrentDomain.BaseDirectory for desktop applications.
/// </param>
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()));
}
}
}
}
@@ -1,39 +0,0 @@
<html lang="en-US">
<head>
<meta charset="utf-8" />
<title>Microsoft.SqlServer.Types</title>
<style>
body {
background: #fff;
color: #505050;
margin: 20px;
}
#main {
background: #efefef;
padding: 5px 30px;
}
</style>
</head>
<body>
<div id="main">
<h1>Action required to load native assemblies</h1>
<p>
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.
</p>
<p>
You need to add code to load the correct one of these assemblies at runtime (depending on the current architecture).
</p>
<h2>ASP.NET applications</h2>
<p>
For ASP.NET applications, add the following line of code to the Application_Start method in Global.asax.cs:
<pre> SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"));</pre>
</p>
<h2>Desktop applications</h2>
<p>
For desktop applications, add the following line of code to run before any spatial operations are performed:
<pre> SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);</pre>
</p>
</div>
</body>
</html>
@@ -1,52 +0,0 @@
param($installPath, $toolsPath, $package, $project)
$packagePath = (New-Object system.IO.DirectoryInfo $toolsPath).Parent.FullName
$cppBinaryPathx86 = Join-Path $packagePath "nativeBinaries\x86\msvcr100.dll"
$cppBinaryPathx64 = Join-Path $packagePath "nativeBinaries\x64\msvcr100.dll"
$sqlBinaryPathx86 = Join-Path $packagePath "nativeBinaries\x86\SqlServerSpatial110.dll"
$sqlBinaryPathx64 = Join-Path $packagePath "nativeBinaries\x64\SqlServerSpatial110.dll"
$sqlServerTypes = $project.ProjectItems.Item("SqlServerTypes")
$folderx86 = $sqlServerTypes.ProjectItems | where Name -eq "x86"
if (!$folderx86)
{
$folderx86 = $sqlServerTypes.ProjectItems.AddFolder("x86")
}
$folderx64 = $sqlServerTypes.ProjectItems | where Name -eq "x64"
if (!$folderx64)
{
$folderx64 = $sqlServerTypes.ProjectItems.AddFolder("x64")
}
$cppLinkx86 = $folderx86.ProjectItems | where Name -eq "msvcr100.dll"
if (!$cppLinkx86)
{
$cppLinkx86 = $folderx86.ProjectItems.AddFromFile($cppBinaryPathx86)
$cppLinkx86.Properties.Item("CopyToOutputDirectory").Value = 2
}
$sqlLinkx86 = $folderx86.ProjectItems | where Name -eq "SqlServerSpatial110.dll"
if (!$sqlLinkx86)
{
$sqlLinkx86 = $folderx86.ProjectItems.AddFromFile($sqlBinaryPathx86)
$sqlLinkx86.Properties.Item("CopyToOutputDirectory").Value = 2
}
$cppLinkx64 = $folderx64.ProjectItems | where Name -eq "msvcr100.dll"
if (!$cppLinkx64)
{
$cppLinkx64 = $folderx64.ProjectItems.AddFromFile($cppBinaryPathx64)
$cppLinkx64.Properties.Item("CopyToOutputDirectory").Value = 2
}
$sqlLinkx64 = $folderx64.ProjectItems | where Name -eq "SqlServerSpatial110.dll"
if (!$sqlLinkx64)
{
$sqlLinkx64 = $folderx64.ProjectItems.AddFromFile($sqlBinaryPathx64)
$sqlLinkx64.Properties.Item("CopyToOutputDirectory").Value = 2
}
$readmefile = Join-Path (Split-Path $project.FileName) "SqlServerTypes\readme.htm"
$dte.ItemOperations.Navigate($readmefile)
@@ -1,52 +0,0 @@
param($installPath, $toolsPath, $package, $project)
$sqlServerTypes = $project.ProjectItems | where Name -eq "SqlServerTypes"
if($sqlServerTypes)
{
$folderx86 = $sqlServerTypes.ProjectItems | where Name -eq "x86"
if ($folderx86)
{
$cppFilex86 = $folderx86.ProjectItems | where Name -eq "msvcr100.dll"
if($cppFilex86)
{
$cppFilex86.Delete();
}
$sqlFilex86 = $folderx86.ProjectItems | where Name -eq "SqlServerSpatial110.dll"
if($sqlFilex86)
{
$sqlFilex86.Delete();
}
if($folderx86.ProjectItems.Count -eq 0)
{
$folderx86.Delete()
}
}
$folderx64 = $sqlServerTypes.ProjectItems | where Name -eq "x64"
if ($folderx64)
{
$cppFilex64 = $folderx64.ProjectItems | where Name -eq "msvcr100.dll"
if($cppFilex64)
{
$cppFilex64.Delete();
}
$sqlFilex64 = $folderx64.ProjectItems | where Name -eq "SqlServerSpatial110.dll"
if($sqlFilex64)
{
$sqlFilex64.Delete();
}
if($folderx64.ProjectItems.Count -eq 0)
{
$folderx64.Delete()
}
}
if($sqlServerTypes.ProjectItems.Count -eq 0)
{
$sqlServerTypes.Delete()
}
}