Commit e3c6a18

mo khan <mo@mokhan.ca>
2010-06-13 17:33:46
switched to sql server ce.
1 parent facdf09
Changed files (2)
product/presentation.windows.server/Bootstrapper.cs
@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using System.Data.SQLite;
+using System.Data.SqlServerCe;
 using System.Diagnostics;
 using System.IO;
 using System.Net;
@@ -91,15 +92,29 @@ namespace presentation.windows.server
         {
             var configuration = new Configuration();
             //var connection = new SQLiteConnection();
-            var database_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"mokhan.ca\momoney\default.db");
+            //var database_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"mokhan.ca\momoney\default.db");
+            var database_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"mokhan.ca\momoney\default.sdf");
+            var connection_string = string.Format("Data Source='{0}'; Password=;Persist Security Info=True", database_path);
+
+            using (var engine = new SqlCeEngine(connection_string))
+            {
+                if (File.Exists(database_path)) File.Delete(database_path);
+                engine.CreateDatabase();
+            }
             var fluent_configuration = Fluently
                 .Configure(configuration)
-                .Database(SQLiteConfiguration.Standard
-                              .UsingFile(database_path)
-                              .AdoNetBatchSize(500)
-                              .ConnectionString(x => x.Is("Data Source={0};Version=3;New=True;".formatted_using(database_path)))
-                              .ShowSql()
-                              .ProxyFactoryFactory<ProxyFactoryFactory>()
+                //.Database(SQLiteConfiguration.Standard
+                //              .UsingFile(database_path)
+                //              .AdoNetBatchSize(500)
+                //              .ConnectionString(x => x.Is("Data Source={0};Version=3;New=True;".formatted_using(database_path)))
+                //              .ShowSql()
+                //              .ProxyFactoryFactory<ProxyFactoryFactory>()
+                //)
+                .Database(
+                    MsSqlCeConfiguration.Standard.ConnectionString(connection_string)
+                    .AdoNetBatchSize(500)
+                    .ShowSql()
+                    .ProxyFactoryFactory<ProxyFactoryFactory>()
                 )
                 //.Database(SQLiteConfiguration.Standard .UsingFile(database_path) )
                 .Mappings(x =>
product/presentation.windows.server/presentation.windows.server.csproj
@@ -94,6 +94,11 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\build\lib\app\sqlite\System.Data.SQLite.dll</HintPath>
     </Reference>
+    <Reference Include="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\thirdparty\sql.server.compact\System.Data.SqlServerCe.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
     <Reference Include="System.Transactions" />
     <Reference Include="System.Xml.Linq">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>