Loading...

fluent-nhibernate@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

[fluent-nhib] Formula Question Dru Sellers Fri Apr 06 04:00:38 2012

I have a property mapped like so:

    //id = 'Subsector_id'
    //className = Subsector
            Map(x => x.TranslatedDescription).Formula(@"(SELECT trans.value
FROM Translations AS trans
WHERE trans.item_id = {0} AND trans.language_id = :Language.Id AND
trans.class_name='{1}')".FormatWith(id, className));

That is generating the hbm.xml

    <property name="TranslatedDescription" formula="(SELECT trans.value
FROM Translations AS trans&#xD;&#xA;WHERE trans.item_id = Subsector_Id AND
trans.language_id = :Language.Id AND trans.class_name='Subsector')"
type="System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089">
      <column name="translated_description" />
    </property>

Should the column name exist? My guess is I have a convention that is
jacking this up maybe?


It might be this one?
        Regex _camel = new Regex("([a-z])([A-Z])");
        public void Apply(IPropertyInstance instance)
        {
            var name = _camel.Replace(instance.Property.Name,
"$1_$2").ToLower();
            instance.Column(name);
        }

should i be checking for the existence of formula?

-d

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en.