c# - NHibernate. SessionFactory.Delete deletes all tables -
i try run example https://github.com/jagregory/fluent-nhibernate/wiki/getting-started after running next code tables cleared. don't understand why happens. expecting store var barginbasin = new store { name = "bargin basin" };
, rows table storeproduct
store_id
of store deleted.
using (var session = sessionfactory.opensession()) { session.delete(session.createcriteria(typeof (store)).list<store>()[0]); session.flush(); }
sessionfactory
initialization:
var dbconfig = oracledataclientconfiguration.oracle10 .connectionstring(c => c.fromconnectionstringwithkey("oracle")) .driver<oracledataclientdriver>() .showsql(); sessionfactory = fluently.configure() .database(dbconfig) .mappings(m => m.fluentmappings.addfromassemblyof<employee>()) .buildsessionfactory();
app.config:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedruntime version="v4.0" sku=".netframework,version=v4.5" /> </startup> <connectionstrings> <add name="oracle" connectionstring="data source=(description=(address=(protocol=tcp)(host=[ip])(port=[port]))(connect_data=(service_name=xe)));password=[password];persist security info=true;user id=[user id]" providername="oracle.dataaccess.client" /> </connectionstrings> </configuration>
Comments
Post a Comment