From 11a9c339d957b0dcc0dcad78eb603be36c8241fb Mon Sep 17 00:00:00 2001 From: ErikEJ Date: Wed, 11 Oct 2017 13:18:47 +0200 Subject: [PATCH] SQL Server Compact Edition support supercedes #139 --- .../Properties/AssemblyInfo.cs | 6 + .../SqlServerCEDatabase.cs | 461 ++++++++++++++++++ .../orm/SciptsRunMapping.cs | 32 ++ .../orm/ScriptsRunErrorMapping.cs | 33 ++ .../orm/VersionMapping.cs | 28 ++ .../packages.config | 6 + .../roundhouse.databases.sqlserverce.csproj | 75 +++ .../roundhouse/databases/DefaultDatabase.cs | 10 +- .../DatabaseTypeSynonyms.cs | 5 + .../NHibernateSessionFactoryBuilder.cs | 4 + roundhouse.sln | 9 + 11 files changed, 664 insertions(+), 5 deletions(-) create mode 100644 product/roundhouse.databases.sqlserverce/Properties/AssemblyInfo.cs create mode 100644 product/roundhouse.databases.sqlserverce/SqlServerCEDatabase.cs create mode 100644 product/roundhouse.databases.sqlserverce/orm/SciptsRunMapping.cs create mode 100644 product/roundhouse.databases.sqlserverce/orm/ScriptsRunErrorMapping.cs create mode 100644 product/roundhouse.databases.sqlserverce/orm/VersionMapping.cs create mode 100644 product/roundhouse.databases.sqlserverce/packages.config create mode 100644 product/roundhouse.databases.sqlserverce/roundhouse.databases.sqlserverce.csproj diff --git a/product/roundhouse.databases.sqlserverce/Properties/AssemblyInfo.cs b/product/roundhouse.databases.sqlserverce/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..b6516e49 --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/Properties/AssemblyInfo.cs @@ -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")] \ No newline at end of file diff --git a/product/roundhouse.databases.sqlserverce/SqlServerCEDatabase.cs b/product/roundhouse.databases.sqlserverce/SqlServerCEDatabase.cs new file mode 100644 index 00000000..25242154 --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/SqlServerCEDatabase.cs @@ -0,0 +1,461 @@ +using System.Data.SqlServerCe; + +namespace roundhouse.databases.sqlserverce +{ + using System; + using System.IO; + using System.Data; + using System.Security.Principal; + using infrastructure.app; + using infrastructure.logging; + using roundhouse.connections; + using infrastructure.filesystem; + + /// + /// Provider for SQL Server Compact Edition 4.0 databases. + /// + /// These don't have a master database so if you perform operations under + /// the admin connection it is the same as the default. + /// + /// Additionally, the RoundhousE tables use "Roundhouse_" + /// as a prefix instead of a schema as there are none in SQL Server Compact Edition. + /// + /// Use the filename as the server parameter in the command-line console. + /// + public class SqlServerCEDatabase : AdoNetDatabase + { + private string connect_options = "Persist Security Info=False"; + + public SqlServerCEDatabase() + { + version_table_name = "RoundhousE_Version"; + scripts_run_table_name = "RoundhousE_ScriptsRun"; + scripts_run_errors_table_name = "RoundhousE_ScriptsRunErrors"; + command_timeout = 0; + admin_command_timeout = 0; + } + + public override string sql_statement_separator_regex_pattern + { + get + { + const string strings = @"(?'[^']*')"; + const string dashComments = @"(?--.*$)"; + const string starComments = @"(?/\*[\S\s]*?\*/)"; + const string separator = @"(?\s)(?GO)(?\s|$)"; + return strings + "|" + dashComments + "|" + starComments + "|" + separator; + } + } + + public override void initialize_connections(ConfigurationPropertyHolder configuration_property_holder) + { + if (!string.IsNullOrEmpty(connection_string)) + { + var connection_string_builder = new SqlCeConnectionStringBuilder(connection_string); + server_name = connection_string_builder.DataSource; + } + + if (string.IsNullOrEmpty(connection_string)) + { + connection_string = build_connection_string(server_name, connect_options); + admin_connection_string = connection_string; + } + + configuration_property_holder.ConnectionString = connection_string; + configuration_property_holder.ConnectionStringAdmin = connection_string; + + set_provider(); + } + + public override void set_provider() + { + provider = "System.Data.SqlServerCe.4.0"; + } + + private static string build_connection_string(string server_name, string connection_options) + { + return string.Format("data source={0};{1}", server_name, connection_options); + } + + protected override void connection_specific_setup(IDbConnection connection) + { + //((SqlCeConnection)connection).InfoMessage += (sender, e) => Log.bound_to(this).log_a_debug_event_containing(" [SQL PRINT]: {0}{1}", Environment.NewLine, e.Message); + } + + public override void open_admin_connection() + { + Log.bound_to(this).log_a_debug_event_containing("Opening admin connection to '{0}'", connection_string); + server_connection = new AdoNetConnection(new SqlCeConnection(connection_string)); + server_connection.open(); + } + + public override void open_connection(bool with_transaction) + { + Log.bound_to(this).log_a_debug_event_containing("Opening connection to '{0}'", connection_string); + server_connection = new AdoNetConnection(new SqlCeConnection(connection_string)); + server_connection.open(); + + if (with_transaction) + { + transaction = server_connection.underlying_type().BeginTransaction(); + } + + set_repository(); + if (repository != null) + { + repository.start(with_transaction); + } + } + + public override void run_database_specific_tasks() + { + } + + public override string create_database_script() + { + return string.Empty; + } + + public string create_roundhouse_schema_script() + { + return string.Empty; + } + + public override bool create_database_if_it_doesnt_exist(string custom_create_database_script) + { + try + { + SqlCeEngine engine = new SqlCeEngine(this.connection_string); + engine.CreateDatabase(); + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Unable to open file at {0}, error was: {1}", server_name, ex.Message)); + } + + return true; + } + + public override void delete_database_if_it_exists() + { + if (File.Exists(server_name)) + { + File.Delete(server_name); + } + } + + public override string set_recovery_mode_script(bool simple) + { + return string.Empty; + } + + public override string restore_database_script(string restore_from_path, string custom_restore_options) + { + return string.Empty; + } + + public override string delete_database_script() + { + return string.Empty; + } + + public override void insert_script_run(string script_name, string sql_to_run, string sql_to_run_hash, bool run_this_script_once, long version_id) + { + SqlCeConnection conn = null; + + try + { + using (conn = new SqlCeConnection(connection_string)) + { + conn.Open(); + + DateTime now = DateTime.Now; + + using (SqlCeCommand cmd = conn.CreateCommand()) + { + cmd.Parameters.AddWithValue("version_id", version_id); + cmd.Parameters.AddWithValue("script_name", script_name); + cmd.Parameters.AddWithValue("sql_to_run", ((object)sql_to_run) ?? DBNull.Value); + cmd.Parameters.AddWithValue("sql_to_run_hash", ((object)sql_to_run_hash) ?? DBNull.Value); + cmd.Parameters.AddWithValue("run_this_script_once", run_this_script_once); + cmd.Parameters.AddWithValue("now", now); + cmd.Parameters.AddWithValue("currentUser", GetCurrentUser()); + + cmd.CommandText = "INSERT INTO [RoundhousE_ScriptsRun]" + + "([version_id]" + + ",[script_name]" + + ",[text_of_script]" + + ",[text_hash]" + + ",[one_time_script]" + + ",[entry_date]" + + ",[modified_date]" + + ",[entered_by])" + + " VALUES(" + + " @version_id " + + ", @script_name " + + ", @sql_to_run " + + ", @sql_to_run_hash " + + ", @run_this_script_once " + + ", @now " + + ", @now " + + ", @currentUser)"; + cmd.ExecuteNonQuery(); + } + } + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Unable to insert row in RoundhousE_ScriptsRun table. Error was {0}", ex.Message)); + } + } + + public override 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) + { + SqlCeConnection conn = null; + + try + { + using (conn = new SqlCeConnection(connection_string)) + { + conn.Open(); + + DateTime now = DateTime.Now; + + using (SqlCeCommand cmd = conn.CreateCommand()) + { + cmd.Parameters.AddWithValue("script_name", script_name); + cmd.Parameters.AddWithValue("sql_to_run", ((object)sql_to_run) ?? DBNull.Value); + cmd.Parameters.AddWithValue("sql_erroneous_part", ((object)sql_erroneous_part) ?? DBNull.Value); + cmd.Parameters.AddWithValue("error_message", error_message); + cmd.Parameters.AddWithValue("repository_version", repository_version); + cmd.Parameters.AddWithValue("repository_path", ((object)repository_path) ?? DBNull.Value); + cmd.Parameters.AddWithValue("now", now); + cmd.Parameters.AddWithValue("currentUser", GetCurrentUser()); + + cmd.CommandText = "INSERT INTO [RoundhousE_ScriptsRunErrors]" + + "([repository_path]" + + ",[version]" + + ",[script_name]" + + ",[text_of_script]" + + ",[erroneous_part_of_script]" + + ",[error_message]" + + ",[entry_date]" + + ",[modified_date]" + + ",[entered_by])" + + " VALUES(" + + "@repository_path " + + ", @repository_version " + + ", @script_name " + + ", @sql_to_run " + + ", @sql_erroneous_part " + + ", @error_message " + + ", @now " + + ", @now " + + ", @currentUser)"; + cmd.ExecuteNonQuery(); + } + } + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Unable to insert row in RoundhousE_ScriptsRunErrors table. Error was {0}", ex.Message)); + } + } + + public override string get_version(string repository_path) + { + SqlCeConnection conn = null; + + try + { + using (conn = new SqlCeConnection(connection_string)) + { + conn.Open(); + + DateTime now = DateTime.Now; + + using (SqlCeCommand cmd = conn.CreateCommand()) + { + cmd.CommandText = "SELECT TOP 1 [Version] FROM [RoundhousE_Version] ORDER BY entry_date DESC"; + + object version = cmd.ExecuteScalar(); + + return version == null ? null : version.ToString(); + } + } + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Unable to get version from RoundhousE_Version table. Error was {0}", ex.Message)); + } + } + + public override long insert_version_and_get_version_id(string repository_path, string repository_version) + { + string version = get_version(null); + + long lVersion = version == null ? -1 : Int64.Parse(version); + + long lNewVersion = Int64.Parse(repository_version); + + SqlCeConnection conn = null; + + try + { + using (conn = new SqlCeConnection(connection_string)) + { + conn.Open(); + + DateTime now = DateTime.Now; + + if (lNewVersion > lVersion) + { + using (SqlCeCommand cmd = conn.CreateCommand()) + { + cmd.Parameters.AddWithValue("repository_version", repository_version); + cmd.Parameters.AddWithValue("repository_path", ((object)repository_path) ?? DBNull.Value); + cmd.Parameters.AddWithValue("now", now); + cmd.Parameters.AddWithValue("currentUser", GetCurrentUser()); + + cmd.CommandText = "INSERT INTO [RoundhousE_Version]" + + "([repository_path]" + + ",[version]" + + ",[entry_date]" + + ",[modified_date]" + + ",[entered_by])" + + " VALUES(" + + "@repository_path " + + ", @repository_version " + + ", @now " + + ", @now " + + ", @currentUser)"; + cmd.ExecuteNonQuery(); + } + } + + using (SqlCeCommand cmdLatestVersionId = conn.CreateCommand()) + { + cmdLatestVersionId.CommandText = "SELECT TOP 1 [id] FROM [RoundhousE_Version] ORDER BY entry_date DESC"; + + return Int64.Parse(cmdLatestVersionId.ExecuteScalar().ToString()); + } + } + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Unable to insert new version in RoundhousE_Version table. Error was {0}", ex.Message)); + } + } + + public override string get_current_script_hash(string script_name) + { + SqlCeConnection conn = null; + + try + { + using (conn = new SqlCeConnection(connection_string)) + { + conn.Open(); + + DateTime now = DateTime.Now; + + using (SqlCeCommand cmd = conn.CreateCommand()) + { + cmd.Parameters.AddWithValue("script_name", script_name); + + cmd.CommandText = "SELECT [text_hash] FROM [RoundhousE_ScriptsRun] WHERE script_name = @script_name"; + + object text_hash = cmd.ExecuteScalar(); + + return text_hash == null ? null : text_hash.ToString(); + } + } + } + catch (Exception ex) + { + throw new ApplicationException(string.Format("Unable to retrieve script_hash from RoundhousE_ScriptsRun table. Error was {0}", ex.Message)); + } + } + + public override bool has_run_script_already(string script_name) + { + return get_current_script_hash(script_name) != null; + } + + public override void create_or_update_roundhouse_tables() + { + Log.bound_to(this).log_an_info_event_containing("Creating table [{0}].", version_table_name); + + command_timeout = 0; + + run_sql("CREATE TABLE [RoundhousE_Version](" + + "[id] [bigint] IDENTITY(1,1) PRIMARY KEY, " + + "[repository_path] [nvarchar](255) NULL, " + + "[version] [nvarchar](50) NULL, " + + "[entry_date] [datetime] NULL, " + + "[modified_date] [datetime] NULL, " + + "[entered_by] [nvarchar](50) NULL)", ConnectionType.Default); + + Log.bound_to(this).log_an_info_event_containing("Creating table [{0}].", scripts_run_table_name); + + run_sql("CREATE TABLE [RoundhousE_ScriptsRun](" + + "[id] [bigint] IDENTITY(1,1) PRIMARY KEY," + + "[version_id] [bigint] NULL," + + "[script_name] [nvarchar](255) NULL," + + "[text_of_script] [ntext] NULL," + + "[text_hash] [nvarchar](512) NULL," + + "[one_time_script] [bit] NULL," + + "[entry_date] [datetime] NULL," + + "[modified_date] [datetime] NULL," + + "[entered_by] [nvarchar](50) NULL)", ConnectionType.Default); + + Log.bound_to(this).log_an_info_event_containing("Creating table [{0}].", scripts_run_errors_table_name); + + run_sql("CREATE TABLE [RoundhousE_ScriptsRunErrors](" + + "[id] [bigint] IDENTITY(1,1) PRIMARY KEY," + + "[repository_path] [nvarchar](255) NULL," + + "[version] [nvarchar](50) NULL," + + "[script_name] [nvarchar](255) NULL," + + "[text_of_script] [ntext] NULL," + + "[erroneous_part_of_script] [ntext] NULL," + + "[error_message] [ntext] NULL," + + "[entry_date] [datetime] NULL," + + "[modified_date] [datetime] NULL," + + "[entered_by] [nvarchar](50) NULL)", ConnectionType.Default); + } + + /// + /// Low level hit to query the database for a restore + /// + private DataTable execute_datatable(string sql_to_run) + { + DataSet result = new DataSet(); + + using (IDbCommand command = setup_database_command(sql_to_run, ConnectionType.Default, null)) + { + using (IDataReader data_reader = command.ExecuteReader()) + { + DataTable data_table = new DataTable(); + data_table.Load(data_reader); + data_reader.Close(); + data_reader.Dispose(); + + result.Tables.Add(data_table); + } + command.Dispose(); + } + + return result.Tables.Count == 0 ? null : result.Tables[0]; + } + + /// + /// Returns the currently logged in Windows user. + /// + /// The current user or an empty string if not available. + private string GetCurrentUser() + { + return WindowsIdentity.GetCurrent() != null ? WindowsIdentity.GetCurrent().Name : string.Empty; + } + } +} \ No newline at end of file diff --git a/product/roundhouse.databases.sqlserverce/orm/SciptsRunMapping.cs b/product/roundhouse.databases.sqlserverce/orm/SciptsRunMapping.cs new file mode 100644 index 00000000..4dd708ba --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/orm/SciptsRunMapping.cs @@ -0,0 +1,32 @@ +namespace roundhouse.databases.sqlserverce.orm +{ + using System; + using FluentNHibernate.Mapping; + using infrastructure; + using model; + + [CLSCompliant(false)] + public class ScriptsRunMapping : ClassMap + { + 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); + } + } +} \ No newline at end of file diff --git a/product/roundhouse.databases.sqlserverce/orm/ScriptsRunErrorMapping.cs b/product/roundhouse.databases.sqlserverce/orm/ScriptsRunErrorMapping.cs new file mode 100644 index 00000000..6fe43b0e --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/orm/ScriptsRunErrorMapping.cs @@ -0,0 +1,33 @@ +namespace roundhouse.databases.sqlserverce.orm +{ + using System; + using FluentNHibernate.Mapping; + using infrastructure; + using model; + + [CLSCompliant(false)] + public class ScriptsRunErrorMapping : ClassMap + { + 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); + } + } +} \ No newline at end of file diff --git a/product/roundhouse.databases.sqlserverce/orm/VersionMapping.cs b/product/roundhouse.databases.sqlserverce/orm/VersionMapping.cs new file mode 100644 index 00000000..1c34cce0 --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/orm/VersionMapping.cs @@ -0,0 +1,28 @@ +namespace roundhouse.databases.sqlserverce.orm +{ + using System; + using FluentNHibernate.Mapping; + using infrastructure; + + [CLSCompliant(false)] + public class VersionMapping : ClassMap + { + 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); + } + } +} \ No newline at end of file diff --git a/product/roundhouse.databases.sqlserverce/packages.config b/product/roundhouse.databases.sqlserverce/packages.config new file mode 100644 index 00000000..e7a70752 --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/product/roundhouse.databases.sqlserverce/roundhouse.databases.sqlserverce.csproj b/product/roundhouse.databases.sqlserverce/roundhouse.databases.sqlserverce.csproj new file mode 100644 index 00000000..d4b4b410 --- /dev/null +++ b/product/roundhouse.databases.sqlserverce/roundhouse.databases.sqlserverce.csproj @@ -0,0 +1,75 @@ + + + + + Debug + AnyCPU + {3447F080-CF50-4B02-9521-671E7AEE8D34} + Library + Properties + roundhouse.databases.sqlserverce + roundhouse.databases.sqlserverce + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\FluentNHibernate.1.3.0.733\lib\FluentNHibernate.dll + True + + + ..\..\packages\Iesi.Collections.3.2.0.4000\lib\Net35\Iesi.Collections.dll + True + + + ..\..\packages\NHibernate.3.3.1.4000\lib\Net35\NHibernate.dll + True + + + + + False + ..\..\..\..\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll + + + + + + + + + + + + + + + + + + {a95de649-d5ba-4402-9d9c-3d8d67e2ff44} + roundhouse + + + + + + + \ No newline at end of file diff --git a/product/roundhouse/databases/DefaultDatabase.cs b/product/roundhouse/databases/DefaultDatabase.cs index 015f21b0..7fc49dea 100644 --- a/product/roundhouse/databases/DefaultDatabase.cs +++ b/product/roundhouse/databases/DefaultDatabase.cs @@ -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> 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_error(string script_name, string sql_to_run, strin } } - 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; diff --git a/product/roundhouse/infrastructure.app/DatabaseTypeSynonyms.cs b/product/roundhouse/infrastructure.app/DatabaseTypeSynonyms.cs index 44d2a6ca..a949ac9b 100644 --- a/product/roundhouse/infrastructure.app/DatabaseTypeSynonyms.cs +++ b/product/roundhouse/infrastructure.app/DatabaseTypeSynonyms.cs @@ -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"; diff --git a/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs b/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs index 5351771e..cf0b1cde 100644 --- a/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs +++ b/product/roundhouse/infrastructure/persistence/NHibernateSessionFactoryBuilder.cs @@ -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, diff --git a/roundhouse.sln b/roundhouse.sln index 52fbd43f..69483763 100644 --- a/roundhouse.sln +++ b/roundhouse.sln @@ -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