views:

77

answers:

2

I have a a sql database in my app_data folder and my connection string looks like this:

Server=.\SQLExpress;AttachDbFilename=|DataDirectory|wikipediamaze.mdf; Trusted_Connection=Yes;

I'm using Fluent Nhibernate, and everything is mapped properly. I'm able to connect to the database fine and even update and insert rows with no problem.

My issue is that once I stop debugging, none of my data is there. I've checked to see if perhaps my database was being put in the bin folder and a new instance was being created for every time I ran the app, but this is not the case.

Does anyone have any other suggestions? I've spent 2 nights now trying to figure this out.

Thanks!

A: 

One possibility is that you do not commit your changes. Start SQL Profiler and you'll see exactly what SQL is run against your database.

AlexKuznetsov
Is there something special I need to do commit the changes orther than session.Save(myObj); ?
Micah
A: 

The issue I was having was that I was improperly using the NHibernate session. I needed to call ISession.Flush or ITransaction.Commit to persist it to the database.

Micah