Hello All,
I have a use case, in which I have to derive the value of one
property based on another and EntityKey of the object. This property
is a read-only property. The Object is getting persisted but when I
load the object from the DB, I would expect that the formula gets
execute and will get the value for my property. On the NHibernate
profiler, I could see the formula and result but my property is
returning empty string. Here is my class and map file.
public class CustomEntitiesMetaData {
public CustomEntitiesMetaData()
{
Name = string.Empty;
DisplayName = string.Empty;
InternalName = string.Empty
DomainEntityName = string.Empty;
Description = string.Empty;
}
public virtual string Name { get; protected set; }
public virtual string DisplayName { get; protected set; }
public virtual string DomainEntityName { get; protected set; }
public virtual string InternalName
{
get
{
return _internalName;
}
}
public virtual string Description { get; protected set; }
}
}
Here is the map...
<?xml version="1.0" encoding="utf-8" ?>
- <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="Test" namespace="Test">
- <class name="CustomEntitiesMetaData" table="CustomEntitiesMetaData">
- <id name="EntityKey" column="CustomEntitiesMetaDataPkey">
<generator class="native" />
</id>
<property name="Name" />
<property name="DisplayName" />
<property name="Description" />
<property name="DomainEntityName" />
<property name="InternalName" type="string"
access="nosetter.camelcase-underscore" formula="(select
'CustomEntity_'+DomainEntityName+'_'+CAST(CustomEntitiesMetaDataPkey
AS varchar(max)) From dbo.CustomEntitiesMetaData Where
CustomEntitiesMetaData.CustomEntitiesMetaDataPkey =
CustomEntitiesMetaDataPkey)" />
</class>
</hibernate-mapping>
Any Help is appreciated!
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.