I've tried for days to get my countrys to not load the cities and states, however ive tried a few things and i dont seem to get anywhere. When I check the property values in my debugger, sure enough i can see everything.
Here's my xml file for countries:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" schema="dbo">
<class name="DAL.Country, DAL" table="Countries" lazy="true">
<id name="Id" type="Int32" column="country_id">
<generator class="identity" />
</id>
<bag name="Cities" inverse="true">
<key column="country_id" />
<one-to-many class="DAL.City, DAL" />
</bag>
<property name="countryprefix" column="country_prefix" type="String" />
<property name="countryname" column="countryname" type="String" />
<bag name="States" inverse="true">
<key column="country_id" />
<one-to-many class="DAL.State, DAL" />
</bag>
</class>
</hibernate-mapping>
And my code:
Code:
session = Global.Factory;
IList countries = null;
Country country = new Country();
string query = "from DAL.Country";
countries = session.Find(query);
session.Close();
Can anyone see something I cant?