I'm new to Fluent NHibernate.  I followed the example at 
https://github.com/jagregory/fluent-nhibernate/wiki/Getting-started

The example showed how to Create and Read entities.  At run-time, it 
creates 2 stores.

I added a *DeleteByStoreId() *method to this sample code.

        public static void *DeleteByStoreId*(int StoreId)
        {
            var sessionFactory = CreateSessionFactory();

            using (var session = sessionFactory.OpenSession())
            {
                using (var transaction = session.BeginTransaction())
                {
                    var store = session.Get<Store>(StoreId);

                    if (store != null)
                    {
                        session.Delete(store);
                    }

                    transaction.Commit();
                }
            }
        }

When I execute DeleteByStoreId by supplying one of the two existing StoreId,it 
somehow deletes BOTH stores. I would have expected it to delete ONLY the one 
store with the given 
StoreId.  Can you tell me what I'm doing wrong?

I have to prove to my boss that Fluent NHibernate is capable of doing the 
CRUD operations so that I get the go ahead to use it in my new project. 
 Hope you can answer me as soon as possible.

Thank you!

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

Reply via email to