I will typically put my component classes in a different namespace. For example, I'll put my entities in a folder/namespace "Model" and my components in a folder/namespace "Model.Components".
With this convention, it is easy to set up the fluent mappings to treat components as components. AutoMap.AssemblyOf<YOUR_ASSEMBLY>() .Setup(s => { s.IsComponentType = t => t.Namespace == "Hedgehop.Model.Components"; s.GetComponentColumnPrefix = type => type.Name + "_"; }) On Jan 21, 6:44 am, Kenneth Cochran <kenneth.coch...@gmail.com> wrote: > So I was using the Automapper exclusively, feeding it only types that > implemented an interface I had defined called IEntity. It this was > working good until I realized I needed to map some value object types > as components. So I instead of only mapping implementations of IEntity > I changed automapper to map everything in the the "Domain" namespace. > Thats when I started having trouble. > > The way my application is organized, each domain aggregate is defined > in a separate assembly (along with views, presenters and import/export > features) which is dynamically loaded at runtime. So each plugin > assembly has a "Domain" namespace containing the entities and value > objects used by that aggregate. > > Anyway, none of my value objects are mapping correctly as components. > The automapper tries to map them as normal entities but since they > don't have an Id field nhibernate chokes on the first one. I've tried > several different approaches: defining a blank interface which all > value object implement, moving all value objects to separate > namespace, referencing each value object type individually in the > lambda expression for IsComponentType. > > All attempts produced the same result so I decided to try something > else; I created a sample project to try to reproduce and isolate the > problem. Well, my sample project ran flawlessly. I tried one over and > over but I couldn't reproduce the problem I'm having in my main > application. > > So I'm now to the point where I've downloaded the source for fluent > nhibernate and tried stepping through the automapping process. Being > unfamiliar with how the automapper works, I'm completely lost. Those > three simple lines I wrote to invoke the Automapper hide an extremely > complex series of jumps and branches and I can't possibly follow > without at least several weeks/months of learning. > > Could someone throw me a bone and point me to where in the Automapping > code I should focus to find out why my classes aren't mapping as > components? -- 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.