Hi Ken. This is one reason. The other is that I'm really trying to let the project less dependent as possible from other projects, since this isn't a personal project.
I don't know yet also because it only happened in one case that I was trying to filter by this enumerator in a linq query. If the number of cases start to rise I will really consider to use D9. Even not using it yet I think that this patch would be nice. Thank you On Jun 16, 6:12 pm, Ken Egozi <[email protected]> wrote: > If I get it correctly, the reason you're not into using D9's DescribedEnum > is cuz you already use the Description for something else? > > see, D9 is open source. I will happily accept a patch that can make the > DescribedEnum usertype to work with a Custom Attribute instead of the > default description attribute. Shouldn't be too tricky. > > > > > > On Tue, Jun 16, 2009 at 11:44 PM, CassioT <[email protected]> wrote: > > > Now I found the problem. Here is the explanation: > > > public class Foo > > { > > private string status; > > public StatusEnum > > { > > get > > { > > if(status == "A") > > return StatusEnum.Available; > > else > > return StatusEnum.NatAvailable; > > } > > set > > { > > if(value == StatusEnum.Available) > > status = "A"; > > else > > status = "NA"; > > } > > } > > } > > > The important part of the mapping > > > <property column="Status" type="String" name="status" not-null="true" > > access="field"/> > > > So, I was filtering some data with Linq2NH and an exception was > > thrown: > > > "could not resolve property: Status of: FooNameSpace.Foo" > > > Then I tried a simple Criteira > > > ICriteria cr = session.CreateCriteria(typeof(Foo)); > > cr.Add(Expression.Eq("Status", StatusEnum.Available)); > > > And got the same exception. I thought that NH was not using the field > > as I mapped but... > > > ICriteria cr = session.CreateCriteria(typeof(Foo)); > > cr.Add(Expression.Eq("status", "A")); > > > And it worked - of course - NHibernate is accessing the field as I > > told it to do. > > > Using Criteria is easy to make it work but using Linq2NH I don't see > > how. > > Maybe the way Fabio told me before, but I didn't want to referece D9 > > assemblies and create > > a custom attribute (since I already use Description Attribute ) for > > this. > > > On Jun 15, 8:15 pm, CassioT <[email protected]> wrote: > > > OK. I will investigate more and come back later. > > > > On Jun 15, 6:46 pm, Fabio Maulo <[email protected]> wrote: > > > > > 2009/6/15 CassioT <[email protected]> > > > > > > So, why it doesn't use the field value to query? > > > > > I have the same question... without mappings, classes and query is hard > > to > > > > answer. > > > > What I'm pretty sure is that we have specific tests for that situation > > and > > > > our tests does not fail. > > > > > -- > > > > Fabio Maulo > > -- > Ken > Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.gotfriends.co.il --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
