Hmm. From what I can gather from the exception, there's something that is
referring to your class as just Test, rather than by the fully qualified
name. Should just be a case of finding the place where this is happening,
it's more than likely one of the other parts. A test or example project
would probably help a lot.

On Tue, Aug 18, 2009 at 12:55 PM, Scott Cowan <
[email protected]> wrote:

>
> sure here's the exception, I can create a solution with it reproduced
> if that helps
>
> FluentNHibernate.Cfg.FluentConfigurationException was unhandled
>  Message="An invalid or incomplete configuration was used while
> creating a SessionFactory. Check PotentialReasons collection, and
> InnerException for more detail.\r\n\r\n"
>  Source="FluentNHibernate"
>  StackTrace:
>       at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration
> () in c:\Documents and Settings\Administrator\dev\fluent-nhibernate\src
> \FluentNHibernate\Cfg\FluentConfiguration.cs:line 121
>       at importer.nba.svc.Program.Main(String[] args) in C:\code
> \sportinginsider\datamining\misc\TempImporter\trunk\src
> \nba.importer.svc\Program.cs:line 24
>       at System.AppDomain._nExecuteAssembly(Assembly assembly, String
> [] args)
>       at
> Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>       at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>       at System.Threading.ThreadHelper.ThreadStart()
>  InnerException: NHibernate.MappingException
>       Message="Could not compile the mapping document: (XmlDocument)"
>       Source="NHibernate"
>       StackTrace:
>            at NHibernate.Cfg.Configuration.LogAndThrow(Exception
> exception)
>            at NHibernate.Cfg.Configuration.AddValidatedDocument
> (NamedXmlDocument doc)
>            at NHibernate.Cfg.Configuration.ProcessMappingsQueue()
>            at NHibernate.Cfg.Configuration.AddDocumentThroughQueue
> (NamedXmlDocument document)
>            at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader
> hbmReader, String name)
>            at NHibernate.Cfg.Configuration.AddInputStream(Stream
> xmlInputStream, String name)
>            at NHibernate.Cfg.Configuration.AddDocument(XmlDocument
> doc, String name)
>            at NHibernate.Cfg.Configuration.AddDocument(XmlDocument
> doc)
>            at FluentNHibernate.PersistenceModel.Configure
> (Configuration cfg) in c:\Documents and Settings\Administrator\dev
> \fluent-nhibernate\src\FluentNHibernate\PersistenceModel.cs:line 203
>            at
> FluentNHibernate.Automapping.AutoPersistenceModel.Configure
> (Configuration configuration) in c:\Documents and Settings
> \Administrator\dev\fluent-nhibernate\src\FluentNHibernate\Automapping
> \AutoPersistenceModel.cs:line 125
>            at FluentNHibernate.Cfg.AutoMappingsContainer.Apply
> (Configuration cfg) in c:\Documents and Settings\Administrator\dev
> \fluent-nhibernate\src\FluentNHibernate\Cfg
> \AutoMappingsContainer.cs:line 64
>            at FluentNHibernate.Cfg.MappingConfiguration.Apply
> (Configuration cfg) in c:\Documents and Settings\Administrator\dev
> \fluent-nhibernate\src\FluentNHibernate\Cfg
> \MappingConfiguration.cs:line 65
>            at
> FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in c:
> \Documents and Settings\Administrator\dev\fluent-nhibernate\src
> \FluentNHibernate\Cfg\FluentConfiguration.cs:line 112
>       InnerException: NHibernate.DuplicateMappingException
>            Message="duplicate import: Test refers to both
> Sample.Models.Test2.Test, importer.nba.svc, Version=1.0.0.0,
> Culture=neutral, PublicKeyToken=null and Sample.Models.Test1.Test,
> importer.nba.svc, Version=1.0.0.0, Culture=neutral,
> PublicKeyToken=null (try using auto-import=\"false\")"
>            Source="NHibernate"
>            Name="Test"
>            Type="import"
>            StackTrace:
>                 at NHibernate.Cfg.Mappings.AddImport(String
> className, String rename)
>                 at
> NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindPersistentClassCommonValues
> (XmlNode node, IDecoratable classMapping, PersistentClass model,
> IDictionary`2 inheritedMetas)
>                 at NHibernate.Cfg.XmlHbmBinding.ClassBinder.BindClass
> (XmlNode node, IDecoratable classMapping, PersistentClass model,
> IDictionary`2 inheritedMetas)
>                 at NHibernate.Cfg.XmlHbmBinding.RootClassBinder.Bind
> (XmlNode node, HbmClass classSchema, IDictionary`2 inheritedMetas)
>                 at
> NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.AddRootClasses(XmlNode
> parentNode, IDictionary`2 inheritedMetas)
>                 at NHibernate.Cfg.XmlHbmBinding.MappingRootBinder.Bind
> (XmlNode node)
>                 at NHibernate.Cfg.Configuration.AddValidatedDocument
> (NamedXmlDocument doc)
>            InnerException:
>
>
> On Aug 18, 9:14 am, James Gregory <[email protected]> wrote:
> > Looks ok to me mapping wise, I've checked the code and it should cope
> with
> > classes of the same name.
> > Can you show the full exception?
> >
> > On Mon, Aug 17, 2009 at 11:00 PM, Scott Cowan <
> >
> >
> >
> > [email protected]> wrote:
> >
> > > Summary:
> >
> > > I want to save two classes of the same name and different namespaces
> > > with the Fluent NHibernate Automapper in RC1
> >
> > > Context
> >
> > > I'm writing having to import a lot of different objects to database
> > > for testing. I'll eventually write mappers to a proper model.
> >
> > > I've been using code gen and Fluent NHibernate to take these DTOs and
> > > dump them straight to db.
> >
> > > the exception does say to (try using auto-import="false")
> >
> > > Code
> >
> > > public class ClassConvention : IClassConvention
> > > {
> > >    public void Apply(IClassInstance instance)
> > >    {
> > >        instance.Table(instance.EntityType.Namespace.Replace(".",
> > > "_"));
> > >    }
> > > }
> >
> > > namespace Sample.Models.Test1
> > > {
> > >    public class Test
> > >    {
> > >        public virtual int Id { get; set; }
> > >        public virtual string Something { get; set; }
> > >    }
> > > }
> >
> > > namespace Sample.Models.Test2
> > > {
> > >    public class Test
> > >    {
> > >        public virtual int Id { get; set; }
> > >        public virtual string SomethingElse { get; set; }
> > >    }
> > > }
> > > And here's the actual app code
> >
> > >            var model = AutoMap.AssemblyOf<Service1>()
> > >                .Where(t => t.Namespace.StartsWith("Sample.Models"))
> > >                .Conventions.AddFromAssemblyOf<Service1>();
> > >            var cfg = Fluently.Configure()
> > >                .Database(
> > >                MySQLConfiguration.Standard.ConnectionString(
> > >                    c => c.Is("database=test;server=localhost;user
> > > id=root;Password=;")))
> > >                .Mappings(m => m.AutoMappings.Add(model))
> > >                .BuildConfiguration();
> > >            new SchemaExport(cfg).Execute(false, true, false);
> >
> > > I'm reposting this from
> >
> > >http://stackoverflow.com/questions/1290466/fluent-nhibernate-duplicat.
> ..
> >
> > > thanks
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to