On Nov 2, 5:10 pm, James Gregory <
jagregory....@gmail.com> wrote:
> Automapping has existed for as long as fluent nhibernate has, there's no *
> new* about it.
My mistake - it's ALL new to me! Maybe that's part of my problem - I
don't have any previous experience with NHibernate in any form.
I don't mean to seem ungrateful - I'm just trying to get my project
done. But it's been a very frustrating couple of days...
>
> If you're having issues, you should ask for help. We're here to help. It's
> much easier for us to answer a quick question on the mailing list than it is
> to create another example project. Sure, we should do that, but when our
> time is limited and it's between fixing a bug or creating more examples,
> bugs will always win.
I understand.
> That being said, I truly don't believe it's that
> difficult to use it. I'm interested to know what troubles you had.
>
> Getting the Example.FirstProject to use the automapper should be as simple
> as changing the CreateSessionFactory method to be something like this:
>
> private static ISessionFactory CreateSessionFactory()
> {
> var mappings = AutoMap.AssemblyOf<Product>()
> .Where(t => t.Namespace ==
> "Examples.FirstProject.Entities");
>
> return Fluently.Configure()
> .Database(SQLiteConfiguration.Standard
> .UsingFile(DbFile))
> .Mappings(m =>
> m.AutoMappings.Add(mappings))
> .ExposeConfiguration(BuildSchema)
> .BuildSessionFactory();
Thanks for this, it was very helpful, and it _almost_ works. And for
the first time, the error message was clear enough that I was able to
guess at a brute force workaround for the problem.
I'm not trying to be a wise ass, but as an exercise in putting
yourself in the first time user's shoes, try it yourself. And I'd be
interested to know what the "proper" solution to the cascading saves
problem is.
If you have the time and patience, I'd like to work through this with
you, and would be happy to post it back to the main source when it's
done.
-Tom