c# - Nhibernate Formula Attribute not mapping -
i have basic nhibernate trying use formula mapping attribute on:
create function [dbo].[isvalueapprovalrequired] ( -- add parameters function here @valueapprovalid bigint ) returns bit begin return cast(1 bit) end
my class definition pretty simple, , trying map formula class so:
[class(table="mytable")] public class myclass { private long _id; /// <summary> /// unique identifier object /// </summary> [id(0, name = "id", column = "valueapproval_id")] [generator(1, class = "identity")] public override long id { { return _id; } set { this._id = value; } } [nhibernate.mapping.attributes.formula(content = "(select dbo.isvalueapprovalrequired(id))")] private bool _isvalueapprovalrequired; /// <summary> /// returns if approval considered required. /// </summary> public virtual bool isvalueapprovalrequired { { return _isvalueapprovalrequired; } } }
the class getting loaded, variable mapped formula not getting populated.
does know why not working? watch sql request, , scalar not in given select statement.
thanks in advance!
we had problem too.
you need modify code , add propertyattribute:
[property, formula(content = "(select dbo.isvalueapprovalrequired(id))")]
Comments
Post a Comment