From c1058b23adef4aad33d139b4636447d384827405 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 26 Sep 2011 15:39:02 -0700 Subject: [PATCH] Fixing data migration unit tests --HG-- branch : 1.x --- .../Migration/Records/DataMigrationRecord.cs | 18 +----------------- .../Providers/AbstractDataServicesProvider.cs | 8 ++------ 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/Orchard/Data/Migration/Records/DataMigrationRecord.cs b/src/Orchard/Data/Migration/Records/DataMigrationRecord.cs index 759d96666..3d1be309f 100644 --- a/src/Orchard/Data/Migration/Records/DataMigrationRecord.cs +++ b/src/Orchard/Data/Migration/Records/DataMigrationRecord.cs @@ -1,23 +1,7 @@ -using FluentNHibernate.Mapping; - -namespace Orchard.Data.Migration.Records { +namespace Orchard.Data.Migration.Records { public class DataMigrationRecord { public virtual int Id { get; set; } public virtual string DataMigrationClass { get; set; } public virtual int? Version { get; set; } } - - /// - /// Since the "Version" colmuns is "AutoMapped" in FluentNHibernate, and the currently used version - /// doesn't understand IVersionConvention and IVersionConventionAcceptance, we need to provide a manual - /// mapping. - /// - public sealed class DataMigrationRecordMap : ClassMap { - public DataMigrationRecordMap() { - Table("Orchard_Framework_DataMigrationRecord"); - Id(x => x.Id); - Map(x => x.DataMigrationClass); - Map(x => x.Version); - } - } } \ No newline at end of file diff --git a/src/Orchard/Data/Providers/AbstractDataServicesProvider.cs b/src/Orchard/Data/Providers/AbstractDataServicesProvider.cs index 0dc8c98e7..5030e523c 100644 --- a/src/Orchard/Data/Providers/AbstractDataServicesProvider.cs +++ b/src/Orchard/Data/Providers/AbstractDataServicesProvider.cs @@ -9,7 +9,6 @@ using FluentNHibernate.Conventions.Helpers; using NHibernate.Cfg; using Orchard.ContentManagement.Records; using Orchard.Data.Conventions; -using Orchard.Data.Migration.Records; using Orchard.Environment.ShellBuilders.Models; namespace Orchard.Data.Providers { @@ -23,15 +22,12 @@ namespace Orchard.Data.Providers { return Fluently.Configure() .Database(database) - .Mappings(m => { - m.AutoMappings.Add(persistenceModel); - m.FluentMappings.Add(typeof (DataMigrationRecordMap)); - }) + .Mappings(m => m.AutoMappings.Add(persistenceModel)) .BuildConfiguration(); } public static AutoPersistenceModel CreatePersistenceModel(IEnumerable recordDescriptors) { - return AutoMap.Source(new TypeSource(recordDescriptors.Where(x => x.Type != typeof(DataMigrationRecord)))) + return AutoMap.Source(new TypeSource(recordDescriptors)) // Ensure that namespaces of types are never auto-imported, so that // identical type names from different namespaces can be mapped without ambiguity .Conventions.Setup(x => x.Add(AutoImport.Never()))