this is my current code for configuration. the code inside the lambda
never has an effect on the resulting configuration.

why doesn't this work as expected?

                        FluentConfiguration config = Fluently
                            .Configure()
                            .Database(..omitted for clarity..)
                            .Mappings(m =>
 
m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()));

                        config = config.ExposeConfiguration(c =>
                        {
                            IPreInsertEventListener[] ipils =
c.EventListeners.PreInsertEventListeners;
                            IPreInsertEventListener[] ipils_new = new
IPreInsertEventListener[] { new MyPreInsertEventListener() };
                            c.EventListeners.PreInsertEventListeners =
ipils.Concat(ipils_new).ToArray();
                        });

                        // using QuickWatch to inspect config,
config.Configuration...PreIEListeners is empty
                        _sessionFactory =
config.BuildSessionFactory();



however the following works but is ugly:


                        FluentConfiguration config = Fluently
                            .Configure()
                            .Database(..omitted for clarity..)
                            .Mappings(m =>
 
m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()));

                        NHibernate.Cfg.Configuration temp =
config.BuildConfiguration();
                        IPreInsertEventListener[] ipils =
temp.EventListeners.PreInsertEventListeners;
                        IPreInsertEventListener[] ipils_new = new
IPreInsertEventListener[] { new MyPreInsertEventListener() };
                        temp.EventListeners.PreInsertEventListeners =
ipils.Concat(ipils_new).ToArray();

                        config = Fluently.Configure(temp);
                        _sessionFactory =
config.BuildSessionFactory();


I thought ExposeConfiguration was meant to allow modifications to the
underlying config?

-- 
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