c# - How do you make NHibernate ignore a property in a POCO -
we have poco, like:
public class person { public guid personid { get; set; } public string firstname { get; set; } public string lastname { get; set; } public datetime dateofbirth { get; set; } public string version {get; set; } }
and corresponding hbm file
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="nhibernate.firstattempt" namespace="nhibernate.firstattempt.entity" > <class name="person" lazy="false"> <id name="personid"> <generator class="guid" /> </id> <property name="firstname" /> <property name="lastname" /> <property name="dateofbirth" /> </class> </hibernate-mapping>
if closely, have version property, there no column in database ? want nhibernate ignore property , that's reason did not put property in mapping file. instead started throwing error.
is there way around ?
you should make members virtual , not map property want ignore.
Comments
Post a Comment