Permalink
Browse files

SQL Server Compact Edition support

supercedes #139
  • Loading branch information...
ErikEJ committed Oct 11, 2017
1 parent 2850948 commit 11a9c339d957b0dcc0dcad78eb603be36c8241fb
@@ -0,0 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("00C68829-B216-4CFC-B0C0-4DB304D8F753")]
[assembly: AssemblyKeyFile("..\\..\\RoundhousE.snk")]

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,32 @@
namespace roundhouse.databases.sqlserverce.orm
{
using System;
using FluentNHibernate.Mapping;
using infrastructure;
using model;
[CLSCompliant(false)]
public class ScriptsRunMapping : ClassMap<ScriptsRun>
{
public ScriptsRunMapping()
{
HibernateMapping.Schema(ApplicationParameters.CurrentMappings.roundhouse_schema_name);
Table(ApplicationParameters.CurrentMappings.scripts_run_table_name);
Not.LazyLoad();
HibernateMapping.DefaultAccess.Property();
HibernateMapping.DefaultCascade.SaveUpdate();
Id(x => x.id).Column("id").GeneratedBy.Identity().UnsavedValue(0);
Map(x => x.version_id);
Map(x => x.script_name);
Map(x => x.text_of_script).CustomType("StringClob").CustomSqlType("ntext");
Map(x => x.text_hash).Length(512);
Map(x => x.one_time_script);
//audit
Map(x => x.entry_date);
Map(x => x.modified_date);
Map(x => x.entered_by).Length(50);
}
}
}
@@ -0,0 +1,33 @@
namespace roundhouse.databases.sqlserverce.orm
{
using System;
using FluentNHibernate.Mapping;
using infrastructure;
using model;
[CLSCompliant(false)]
public class ScriptsRunErrorMapping : ClassMap<ScriptsRunError>
{
public ScriptsRunErrorMapping()
{
HibernateMapping.Schema(ApplicationParameters.CurrentMappings.roundhouse_schema_name);
Table(ApplicationParameters.CurrentMappings.scripts_run_errors_table_name);
Not.LazyLoad();
HibernateMapping.DefaultAccess.Property();
HibernateMapping.DefaultCascade.SaveUpdate();
Id(x => x.id).Column("id").GeneratedBy.Identity().UnsavedValue(0);
Map(x => x.repository_path);
Map(x => x.version).Length(50);
Map(x => x.script_name);
Map(x => x.text_of_script).CustomType("StringClob").CustomSqlType("ntext");
Map(x => x.erroneous_part_of_script).CustomType("StringClob").CustomSqlType("ntext");
Map(x => x.error_message).CustomType("StringClob").CustomSqlType("ntext");
//audit
Map(x => x.entry_date);
Map(x => x.modified_date);
Map(x => x.entered_by).Length(50);
}
}
}
@@ -0,0 +1,28 @@
namespace roundhouse.databases.sqlserverce.orm
{
using System;
using FluentNHibernate.Mapping;
using infrastructure;
[CLSCompliant(false)]
public class VersionMapping : ClassMap<roundhouse.model.Version>
{
public VersionMapping()
{
HibernateMapping.Schema(ApplicationParameters.CurrentMappings.roundhouse_schema_name);
Table(ApplicationParameters.CurrentMappings.version_table_name);
Not.LazyLoad();
HibernateMapping.DefaultAccess.Property();
HibernateMapping.DefaultCascade.SaveUpdate();
Id(x => x.id).Column("id").GeneratedBy.Identity().UnsavedValue(0);
Map(x => x.repository_path);
Map(x => x.version).Length(50);
//audit
Map(x => x.entry_date);
Map(x => x.modified_date);
Map(x => x.entered_by).Length(50);
}
}
}
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentNHibernate" version="1.3.0.733" targetFramework="net45" />
<package id="Iesi.Collections" version="3.2.0.4000" targetFramework="net45" />
<package id="NHibernate" version="3.3.1.4000" targetFramework="net45" />
</packages>
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3447F080-CF50-4B02-9521-671E7AEE8D34}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>roundhouse.databases.sqlserverce</RootNamespace>
<AssemblyName>roundhouse.databases.sqlserverce</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentNHibernate, Version=1.3.0.733, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
<HintPath>..\..\packages\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Iesi.Collections, Version=1.0.1.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<HintPath>..\..\packages\NHibernate.3.3.1.4000\lib\Net35\NHibernate.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll</HintPath>

This comment has been minimized.

Show comment
Hide comment
@Liwoj

Liwoj Oct 13, 2017

Contributor

Do we really want take this dependency ? I don't want to install something i really don't need just to be able to build RH. Maybe use this https://www.nuget.org/packages/System.Data.SqlServerCe_unofficial/ ?

@Liwoj

Liwoj Oct 13, 2017

Contributor

Do we really want take this dependency ? I don't want to install something i really don't need just to be able to build RH. Maybe use this https://www.nuget.org/packages/System.Data.SqlServerCe_unofficial/ ?

This comment has been minimized.

Show comment
Hide comment
@erikbra

erikbra Oct 13, 2017

Member

Good point. I had to install Sql Server CE to compile. Don't like that. Maybe it should be optional in some way (can't really have conditional includes in .sln files, can you?)

@erikbra

erikbra Oct 13, 2017

Member

Good point. I had to install Sql Server CE to compile. Don't like that. Maybe it should be optional in some way (can't really have conditional includes in .sln files, can you?)

This comment has been minimized.

Show comment
Hide comment
@ErikEJ

ErikEJ Oct 13, 2017

Contributor

I will update to use a Nuget package 😀

@ErikEJ

ErikEJ Oct 13, 2017

Contributor

I will update to use a Nuget package 😀

This comment has been minimized.

Show comment
Hide comment
@ErikEJ

ErikEJ Oct 13, 2017

Contributor

PR submitted: #282

@ErikEJ

ErikEJ Oct 13, 2017

Contributor

PR submitted: #282

This comment has been minimized.

Show comment
Hide comment
@erikbra

erikbra Oct 13, 2017

Member
@erikbra

erikbra via email Oct 13, 2017

Member

This comment has been minimized.

Show comment
Hide comment
@Liwoj

Liwoj Oct 13, 2017

Contributor

I guess package exists because one and only reason - there is no official one. Not that hard to check if assembly from package is same as the one installed by MS installer.
Anyway i see your point. Ignore Nuget and add assembly to repo - don't force everyone to install...

@Liwoj

Liwoj Oct 13, 2017

Contributor

I guess package exists because one and only reason - there is no official one. Not that hard to check if assembly from package is same as the one installed by MS installer.
Anyway i see your point. Ignore Nuget and add assembly to repo - don't force everyone to install...

This comment has been minimized.

Show comment
Hide comment
@ErikEJ

ErikEJ Oct 13, 2017

Contributor

@Liwoj The package in use in the PR IS official - so I think you are missing the point

@ErikEJ

ErikEJ Oct 13, 2017

Contributor

@Liwoj The package in use in the PR IS official - so I think you are missing the point

This comment has been minimized.

Show comment
Hide comment
@BiggerNoise

BiggerNoise Oct 13, 2017

Member

#282 Uses the official Microsoft NuGet package. We're having some team city issues with the build, but I'll merge the P/R as soon as we sort that out.

Any further discussion should be in the P/R, but I think we have it covered.

@BiggerNoise

BiggerNoise Oct 13, 2017

Member

#282 Uses the official Microsoft NuGet package. We're having some team city issues with the build, but I'll merge the P/R as soon as we sort that out.

Any further discussion should be in the P/R, but I think we have it covered.

This comment has been minimized.

Show comment
Hide comment
@Liwoj

Liwoj Oct 14, 2017

Contributor

@ErikEJ Oh, sorry for confusion. Made same mistake as @erikbra by not realizing Sql Server CE and Compact Edition is same thing

@Liwoj

Liwoj Oct 14, 2017

Contributor

@ErikEJ Oh, sorry for confusion. Made same mistake as @erikbra by not realizing Sql Server CE and Compact Edition is same thing

</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="orm\SciptsRunMapping.cs" />
<Compile Include="orm\ScriptsRunErrorMapping.cs" />
<Compile Include="orm\VersionMapping.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SqlServerCEDatabase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\roundhouse\roundhouse.csproj">
<Project>{a95de649-d5ba-4402-9d9c-3d8d67e2ff44}</Project>
<Name>roundhouse</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -224,7 +224,7 @@ public virtual object run_sql_scalar(string sql_to_run, ConnectionType connectio
protected abstract object run_sql_scalar(string sql_to_run, ConnectionType connection_type, IList<IParameter<IDbDataParameter>> parameters);
public void insert_script_run(string script_name, string sql_to_run, string sql_to_run_hash, bool run_this_script_once, long version_id)
public virtual void insert_script_run(string script_name, string sql_to_run, string sql_to_run_hash, bool run_this_script_once, long version_id)
{
ScriptsRun script_run = new ScriptsRun
{
@@ -248,7 +248,7 @@ public void insert_script_run(string script_name, string sql_to_run, string sql_
}
}
public void insert_script_run_error(string script_name, string sql_to_run, string sql_erroneous_part, string error_message, string repository_version,
public virtual void insert_script_run_error(string script_name, string sql_to_run, string sql_erroneous_part, string error_message, string repository_version,
string repository_path)
{
ScriptsRunError script_run_error = new ScriptsRunError
@@ -274,7 +274,7 @@ public void insert_script_run(string script_name, string sql_to_run, string sql_
}
}
public string get_version(string repository_path)
public virtual string get_version(string repository_path)
{
string version = "0";
@@ -328,13 +328,13 @@ public virtual long insert_version_and_get_version_id(string repository_path, st
return version_id;
}
public string get_current_script_hash(string script_name)
public virtual string get_current_script_hash(string script_name)
{
ScriptsRun script = get_from_script_cache(script_name) ?? get_script_run(script_name);
return script != null ? script.text_hash : string.Empty;
}
public bool has_run_script_already(string script_name)
public virtual bool has_run_script_already(string script_name)
{
ScriptsRun script = get_from_script_cache(script_name) ?? get_script_run(script_name);
return script != null;
@@ -29,6 +29,11 @@ public static string convert_database_type_synonyms(string database_type)
database_type_full_name =
"roundhouse.databases.sqlserver2000.SqlServerDatabase, roundhouse.databases.sqlserver2000";
break;
case "sqlce":
case "sqlserverce":
database_type_full_name =
"roundhouse.databases.sqlserverce.SqlServerCEDatabase, roundhouse.databases.sqlserverce";
break;
case "mysql":
database_type_full_name =
"roundhouse.databases.mysql.MySqlDatabase, roundhouse.databases.mysql";
@@ -27,6 +27,8 @@ public NHibernateSessionFactoryBuilder(ConfigurationPropertyHolder config)
() => MsSqlConfiguration.MsSql2005.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.sqlserver2000.SqlServerDatabase, roundhouse.databases.sqlserver2000",
() => MsSqlConfiguration.MsSql2000.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.sqlserverce.SqlServerCEDatabase, roundhouse.databases.sqlserverce",
() => MsSqlCeConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.mysql.MySqlDatabase, roundhouse.databases.mysql",
() => MySQLConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.oracle.OracleDatabase, roundhouse.databases.oracle",
@@ -44,6 +46,8 @@ public NHibernateSessionFactoryBuilder(ConfigurationPropertyHolder config)
() => MsSqlConfiguration.MsSql2005.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.sqlserver2000.SqlServerDatabase, " + merged_assembly_name,
() => MsSqlConfiguration.MsSql2000.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.sqlserverce.SqlServerCEDatabase, " + merged_assembly_name,
() => MsSqlCeConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.mysql.MySqlDatabase, " + merged_assembly_name,
() => MySQLConfiguration.Standard.ConnectionString(configuration_holder.ConnectionString));
func_dictionary.Add("roundhouse.databases.oracle.OracleDatabase, " + merged_assembly_name,
View
@@ -50,6 +50,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{828B1E
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "roundhouse.databases.sqlserverce", "product\roundhouse.databases.sqlserverce\roundhouse.databases.sqlserverce.csproj", "{3447F080-CF50-4B02-9521-671E7AEE8D34}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Build|Any CPU = Build|Any CPU
@@ -129,6 +131,12 @@ Global
{41CE538E-E6F1-4AB6-AB66-508DEF669A39}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41CE538E-E6F1-4AB6-AB66-508DEF669A39}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41CE538E-E6F1-4AB6-AB66-508DEF669A39}.Release|Any CPU.Build.0 = Release|Any CPU
{3447F080-CF50-4B02-9521-671E7AEE8D34}.Build|Any CPU.ActiveCfg = Release|Any CPU
{3447F080-CF50-4B02-9521-671E7AEE8D34}.Build|Any CPU.Build.0 = Release|Any CPU
{3447F080-CF50-4B02-9521-671E7AEE8D34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3447F080-CF50-4B02-9521-671E7AEE8D34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3447F080-CF50-4B02-9521-671E7AEE8D34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3447F080-CF50-4B02-9521-671E7AEE8D34}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -143,5 +151,6 @@ Global
{35E058E3-8FEE-4107-AEDC-37A452C588EC} = {BCFAF88B-B6C0-48C1-B23E-FCC95B75588C}
{1D41D70E-E310-4699-B7CB-C1F77476A685} = {BCFAF88B-B6C0-48C1-B23E-FCC95B75588C}
{41CE538E-E6F1-4AB6-AB66-508DEF669A39} = {BCFAF88B-B6C0-48C1-B23E-FCC95B75588C}
{3447F080-CF50-4B02-9521-671E7AEE8D34} = {BCFAF88B-B6C0-48C1-B23E-FCC95B75588C}
EndGlobalSection
EndGlobal

0 comments on commit 11a9c33

Please sign in to comment.