Hey James,

Trust me this is the strangest error I've ever come across. It works
fine on my computer at work, I can build with visual studio and
everything works fine.
If I build it with MSbuild it breaks and tries to map my component
types.

If I git clone on my computer at home it is plain and simply broke...
it doesn't work no matter what I try.

After hours of head bashing.... this has fixed my problem on both
computers and it now builds on my CI server with rake.

Old :
            var persistenceModel = AutoMap.AssemblyOf<DomainEntity>()
                .IgnoreBase<DomainEntity>()
                .Setup(s =>
                           {
                               s.IsComponentType =
                                   type =>
 
type.Namespace.EndsWith("Domain.Components");
                               s.GetComponentColumnPrefix =
                                   property =>
                                   property.Name + "_";
                           });
New:

            var persistenceModel =
AutoMap.AssemblyOf<DomainEntity>(x=>x.Namespace.EndsWith("Domain"))
                .IgnoreBase<DomainEntity>()
                .Setup(s =>
                           {
                               s.IsComponentType =
                                   type =>
 
type.Namespace.EndsWith("Domain.Components");
                               s.GetComponentColumnPrefix =
                                   property =>
                                   property.Name + "_";
                           });


Specifing the namespace fixed it. very very wierd.

Thanks for you help
-Ryan

On Feb 18, 3:51 am, James Gregory <jagregory....@gmail.com> wrote:
> I can't see how using a different build tool would affect FNH, unless your
> MSBuild script is using out of date references. FNH is
> not compilation sensitive.
>
> On Wed, Feb 17, 2010 at 8:23 PM, rauh.ryan <rauh.r...@gmail.com> wrote:
> > Sorry, I didn't make my question clear above... oops
>
> > Has anyone else ran into this problem?
> > If so how did you fix it?
>
> > Perhaps its an unforseen bug caused by differences in compilers...
>
> > Although I have come up with a "fix" by using Visual Studio to build
> > instead of MSBuild I would prefer to use MSBuild so I don't need to
> > have Visual Studio on my CI server.
>
> > Thanks Again!
>
> > -Ryan
>
> > On Feb 17, 2:04 pm, "rauh.ryan" <rauh.r...@gmail.com> wrote:
> > > I'm getting some strange behaviors with automappings when I try and
> > > build my project with rake instead of Visual Studio.
>
> > >             var persistenceModel = AutoMap.AssemblyOf<DomainEntity>()
> > >                 .IgnoreBase<DomainEntity>()
> > >                 .Setup(s =>
> > >                            {
> > >                                s.IsComponentType =
> > >                                    type =>
>
> > > type.Namespace.EndsWith("Domain.Components");
> > >                                s.GetComponentColumnPrefix =
> > >                                    property =>
> > >                                    property.Name + "_";
> > >                            });
>
> > > Above is a snippet of my automapping config. as you can see I'm
> > > putting all my component types in the components namespace.
>
> > > Everything works fine when build in visual studio, but when built in
> > > rake with msbuild.exe I get the following exception.
>
> > > Test Case Failures:
> > > 1)
>
> > StreetDoc.Tests.SessionSource.RepositoryTester.can_insert_new_patient_and_ret
> > > rieve_it : FluentNHibernate.Cfg.FluentConfigurationException : An
> > > invalid or inc
> > > omplete configuration was used while creating a SessionFactory. Check
> > > PotentialR
> > > easons collection, and InnerException for more detail.
>
> > >   ----> NHibernate.MappingException : (XmlDocument)(3,6): XML
> > > validation error:
> > > The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has
> > > invalid child
> > > element 'property' in namespace 'urn:nhibernate-mapping-2.2'. List of
> > > possible e
> > > lements expected: 'meta, subselect, cache, synchronize, comment,
> > > tuplizer, id, c
> > > omposite-id' in namespace 'urn:nhibernate-mapping-2.2'.
> > >   ----> System.Xml.Schema.XmlSchemaValidationException : The element
> > > 'class' in
> > > namespace 'urn:nhibernate-mapping-2.2' has invalid child element
> > > 'property' in n
> > > amespace 'urn:nhibernate-mapping-2.2'. List of possible elements
> > > expected: 'meta
> > > , subselect, cache, synchronize, comment, tuplizer, id, composite-id'
> > > in namespa
> > > ce 'urn:nhibernate-mapping-2.2'.
> > > at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in c:
> > > \Users\Rau
> > > hr\Downloads\rauhryan-fluent-nhibernate-dfffb24\src\FluentNHibernate
> > > \Cfg\FluentC
> > > onfiguration.cs:line 119
> > > at
>
> > StreetDoc.MyNHibernate.Session.NHibernateSessionSource.AssemblyConfiguration(
> > > String mappingExportPath) in c:\DEV\Street-Doc\Reboot\personal-sandbox
> > > \src\Stree
> > > tDoc.NHibernate\Session\NHibernateSessionSource.cs:line 69
> > > at
>
> > StreetDoc.MyNHibernate.Session.NHibernateSessionSource..ctor(DatabaseSettings
> > >  databaseSettings) in c:\DEV\Street-Doc\Reboot\personal-sandbox\src
> > > \StreetDoc.NH
> > > ibernate\Session\NHibernateSessionSource.cs:line 42
> > > at StreetDoc.Tests.SessionSource.NHibernateSessionSourceTester.Setup()
> > > in c:\DEV
> > > \Street-Doc\Reboot\personal-sandbox\src\StreetDoc.Tests\SessionSource
> > > \NHibernate
> > > SessionSourceTester.cs:line 25
> > > --MappingException
> > > at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
> > > at NHibernate.Cfg.Configuration.ValidationHandler(Object o,
> > > ValidationEventArgs
> > > args)
> > > at
>
> > System.Xml.Schema.XmlSchemaValidator.SendValidationEvent(ValidationEventHandl
> > > er eventHandler, Object sender, XmlSchemaValidationException e,
> > > XmlSeverityType
> > > severity)
> > > at
>
> > System.Xml.Schema.XmlSchemaValidator.ElementValidationError(XmlQualifiedName
> > > name, ValidationState context, ValidationEventHandler eventHandler,
> > > Object sende
> > > r, String sourceUri, Int32 lineNo, Int32 linePos, Boolean
> > > getParticles)
> > > at
>
> > System.Xml.Schema.XmlSchemaValidator.ValidateElementContext(XmlQualifiedName
> > > elementName, Boolean& invalidElementInContext)
> > > at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String
> > > localName, String
> > >  namespaceUri, XmlSchemaInfo schemaInfo, String xsiType, String
> > > xsiNil, String x
> > > siSchemaLocation, String xsiNoNamespaceSchemaLocation)
> > > at System.Xml.XsdValidatingReader.ProcessElementEvent()
> > > at System.Xml.XsdValidatingReader.ProcessReaderEvent()
> > > at System.Xml.XsdValidatingReader.Read()
> > > at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
> > > at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
> > > at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader,
> > > Boolean preserve
> > > Whitespace)
> > > at System.Xml.XmlDocument.Load(XmlReader reader)
> > > at NHibernate.Cfg.Configuration.LoadMappingDocument(XmlReader
> > > hbmReader, String
> > > name)
> > > at NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader,
> > > String name)
> > > at NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream,
> > > String nam
> > > e)
> > > at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc, String
> > > name)
> > > at NHibernate.Cfg.Configuration.AddDocument(XmlDocument doc)
> > > at FluentNHibernate.PersistenceModel.Configure(Configuration cfg) in c:
> > > \Users\Ra
> > > uhr\Downloads\rauhryan-fluent-nhibernate-dfffb24\src\FluentNHibernate
> > > \Persistenc
> > > eModel.cs:line 189
> > > at
> > > FluentNHibernate.Automapping.AutoPersistenceModel.Configure(Configuration
> > > con
> > > figuration) in c:\Users\Rauhr\Downloads\rauhryan-fluent-nhibernate-
> > > dfffb24\src\F
> > > luentNHibernate\Automapping\AutoPersistenceModel.cs:line 126
> > > at FluentNHibernate.Cfg.AutoMappingsContainer.Apply(Configuration cfg)
> > > in c:\Use
> > > rs\Rauhr\Downloads\rauhryan-fluent-nhibernate-dfffb24\src
> > > \FluentNHibernate\Cfg\A
> > > utoMappingsContainer.cs:line 71
> > > at FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
> > > in c:\User
> > > s\Rauhr\Downloads\rauhryan-fluent-nhibernate-dfffb24\src
> > > \FluentNHibernate\Cfg\Ma
> > > ppingConfiguration.cs:line 56
> > > at FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() in c:
> > > \Users\Rau
> > > hr\Downloads\rauhryan-fluent-nhibernate-dfffb24\src\FluentNHibernate
> > > \Cfg\FluentC
> > > onfiguration.cs:line 110
> > > --XmlSchemaValidationException
>
> > > I've tracked it down to the AddDocument method some where in fluent-
> > > nhibernate. For some reason when built with msbuild FNH is not
> > > respecting the IsComponentType delegate and it is attempting to map
> > > the component type and therefor throws an exception because there is
> > > no Id mapped for the component type.
>
> > > I have altered my build file to use visual studio (devenv.exe) to
> > > build the project instead and everything works great.
>
> > > Thanks for your time and help
>
> > > -Ryan
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Fluent NHibernate" group.
> > To post to this group, send email to fluent-nhibern...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/fluent-nhibernate?hl=en.

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

Reply via email to