On Sat, Aug 30, 2014 at 7:30 AM, Michael Powell <mwpowell...@gmail.com> wrote: > On Sat, Aug 30, 2014 at 6:37 AM, Gleb Chermennov > <thebitteren...@gmail.com> wrote: >> I see your point. >> Can you post your code - classes, mappings and Fluent configuration - >> somewhere on the web (like gist/github) or just email them to me in case >> your project isn't opensource? >> I'll investigate. > > Thanks for being available. > > Upon closer examination, I overlooked a confusion between the ClassMap > and the SubclassMap. ClassMap for the abstract domain class was still > itself abstract. Should just be a concrete class with public > parameterless ctor itself. SubclassMap I extended from an abstract > base class serving the abstract domain model. The domain model itself > is fine as well. > > Thank ye!
I may have spoken too soon. Every Schedule HasOne associated Scheduler, AbstractScheduler, extending into SeasonScheduler, TournamentScheduler, and so on. In the Schedule mapping: HasOne(x => x.Scheduler) .PropertyRef(r => r.Schedule) .Cascade.All(); Unless Fluent and/or NHibernate is having a problem with the abstraction, I fail to see how it does not find the property Schedule referring to the Scheduler's parent. Another possibility, is PropertyRef necessary? Or use References in the child on the other side of the HasOne (or HasMany)? Thank ye... FluentNHibernate.Cfg.FluentConfigurationException was unhandled HResult=-2146233088 Message=An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. Source=FluentNHibernate StackTrace: at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() at Football.Data.Repository.Hibernate.SessionFactoryConfigurator.CreateFactory() in i:\Source\Kingdom Software\Football\Simulator\Football.Data\Repository\Hibernate\SessionFactoryConfigurator.cs:line 66 at Football.Repository.SessionFactoryConfiguratorBase`1.get_Factory() in i:\Source\Kingdom Software\Football\Simulator\Football.Repository\SessionFactoryConfiguratorBase.cs:line 37 at Football.Data.RepositoryExtensionMethods.GetRepositoryForSession[TConfigurator,TRepository](TConfigurator configurator, Func`2 getter, IInterceptor sessionLocalInterceptor) in i:\Source\Kingdom Software\Football\Simulator\Football.Data\Extensions\RepositoryExtensionMethods.cs:line 26 at Football.Migrator.Program.Main(String[] args) in i:\Source\Kingdom Software\Football\Simulator\Football.Migrator\Program.cs:line 52 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: NHibernate.MappingException HResult=-2146232832 Message=property-ref [Parent] not found on entity [Football.Models.Schedulers.AbstractScheduler] Source=NHibernate StackTrace: at NHibernate.Mapping.PersistentClass.GetReferencedProperty(String propertyPath) at NHibernate.Cfg.Configuration.SecondPassCompile() at NHibernate.Cfg.Configuration.BuildSessionFactory() at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() InnerException: NHibernate.MappingException HResult=-2146232832 Message=property [Parent] not found on entity [Football.Models.Schedulers.AbstractScheduler] Source=NHibernate StackTrace: at NHibernate.Mapping.PersistentClass.GetRecursiveProperty(String propertyPath, IEnumerable`1 iter) at NHibernate.Mapping.PersistentClass.GetReferencedProperty(String propertyPath) InnerException: >> суббота, 30 августа 2014 г., 1:41:53 UTC+4 пользователь mwpowellhtx написал: >>> >>> Hello, >>> >>> I've read a post on SO, but I have a case where I don't have a list so >>> much as a HasOne. >>> >>> One of my domain classes HasOne, but that one extends an abstract base >>> class. I want the abstraction to persist to table-per-hierarchy in the usual >>> sense, but how to persuade Fluent (and/or NHibernate) that it's okay to have >>> the abstract base class. >>> >>> In the meantime, I am receiving an exception building the configuration. >>> AbstractScheduler is appropriately abstract, protected-parameterless-ctor, >>> should not be instantiating it. However the mapping wants a >>> public-parameterless-ctor. >>> >>> Otherwise, I have mapped the derived schedulers in the usual SubclassMap >>> sense with a discriminator value. Interested to know how to work past this >>> sort of use case. I could set it up as a "default scheduler" in the base >>> class, but that's not as interesting, and could lead to domain design >>> confusion. >>> >>> Thank you... >>> >>> FluentNHibernate.Cfg.FluentConfigurationException was unhandled >>> HResult=-2146233088 >>> Message=An invalid or incomplete configuration was used while creating a >>> SessionFactory. Check PotentialReasons collection, and InnerException for >>> more detail. >>> >>> >>> Source=FluentNHibernate >>> StackTrace: >>> at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() >>> at >>> Football.Data.Repository.Hibernate.SessionFactoryConfigurator.CreateFactory() >>> in i:\Source\Kingdom >>> Software\Football\Simulator\Football.Data\Repository\Hibernate\SessionFactoryConfigurator.cs:line >>> 66 >>> at >>> Football.Repository.SessionFactoryConfiguratorBase`1.get_Factory() in >>> i:\Source\Kingdom >>> Software\Football\Simulator\Football.Repository\SessionFactoryConfiguratorBase.cs:line >>> 37 >>> at >>> Football.Data.RepositoryExtensionMethods.GetRepositoryForSession[TConfigurator,TRepository](TConfigurator >>> configurator, Func`2 getter, IInterceptor sessionLocalInterceptor) in >>> i:\Source\Kingdom >>> Software\Football\Simulator\Football.Data\Extensions\RepositoryExtensionMethods.cs:line >>> 26 >>> at Football.Migrator.Program.Main(String[] args) in >>> i:\Source\Kingdom >>> Software\Football\Simulator\Football.Migrator\Program.cs:line 52 >>> at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, >>> String[] args) >>> at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence >>> assemblySecurity, String[] args) >>> at >>> Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() >>> at System.Threading.ThreadHelper.ThreadStart_Context(Object state) >>> at System.Threading.ExecutionContext.RunInternal(ExecutionContext >>> executionContext, ContextCallback callback, Object state, Boolean >>> preserveSyncCtx) >>> at System.Threading.ExecutionContext.Run(ExecutionContext >>> executionContext, ContextCallback callback, Object state, Boolean >>> preserveSyncCtx) >>> at System.Threading.ExecutionContext.Run(ExecutionContext >>> executionContext, ContextCallback callback, Object state) >>> at System.Threading.ThreadHelper.ThreadStart() >>> InnerException: FluentNHibernate.Cfg.FluentConfigurationException >>> HResult=-2146233088 >>> Message=An invalid or incomplete configuration was used while >>> creating a SessionFactory. Check PotentialReasons collection, and >>> InnerException for more detail. >>> >>> >>> Source=FluentNHibernate >>> StackTrace: >>> at >>> FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() >>> at >>> FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() >>> InnerException: FluentNHibernate.MissingConstructorException >>> HResult=-2146233088 >>> >>> Message='Football.Data.Mappings.Schedulers.AbstractSchedulerMap, >>> Football.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is >>> missing a parameterless constructor. >>> Source=FluentNHibernate >>> StackTrace: >>> at >>> FluentNHibernate.Utils.Extensions.InstantiateUsingParameterlessConstructor(Type >>> type) >>> at FluentNHibernate.PersistenceModel.Add(Type type) >>> at >>> FluentNHibernate.Utils.CollectionExtensions.Each[T](IEnumerable`1 >>> enumerable, Action`1 each) >>> at >>> FluentNHibernate.PersistenceModel.AddMappingsFromSource(ITypeSource source) >>> at >>> FluentNHibernate.PersistenceModel.AddMappingsFromAssembly(Assembly assembly) >>> at >>> FluentNHibernate.Cfg.FluentMappingsContainer.Apply(PersistenceModel model) >>> at >>> FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg) >>> at >>> FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration() >>> InnerException: >>> >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Fluent NHibernate" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/fluent-nhibernate/7W9BJqh1VsY/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> fluent-nhibernate+unsubscr...@googlegroups.com. >> To post to this group, send email to fluent-nhibernate@googlegroups.com. >> Visit this group at http://groups.google.com/group/fluent-nhibernate. >> For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To unsubscribe from this group and stop receiving emails from it, send an email to fluent-nhibernate+unsubscr...@googlegroups.com. To post to this group, send email to fluent-nhibernate@googlegroups.com. Visit this group at http://groups.google.com/group/fluent-nhibernate. For more options, visit https://groups.google.com/d/optout.