I don't know if this is enough, but you manage it with something like this:
public override bool Equals(object obj) { T other = obj as T; if (other == null) return false;
using the ToUpper () or ToLower () method while comparing your object, or you can use String.Compare (stringA, strngB, StringComparison.OrdinalIgnoreCase).
If you need more control, and if that is your goal, you can create your own Id generator, as described here:
http://nhibernate.info/doc/howto/various/creating-a-custom-id-generator-for-nhibernate.html
updated
Have you tried to create a custom GetIgnoreCase (...)?
I think it is also possible to override the default SELECT statement generated by the Get method in the entity mapping file using the loader tag, like this example:
... <loader query-ref="loadProducts"/> </class> <sql-query name="loadProducts"> <return alias="prod" class="Product" /> <![CDATA[ select ProductID as {prod.ProductID}, UnitPrice as {prod.UnitPrice}, ProductName as {pod.ProductName} from Products prod order by ProductID desc ]]>
You can try changing the select statement that returns the uppercase identifier.
updated
After the investigation, I think that a way to solve your problem can be with Interceptor!
Read here:
http://knol.google.com/k/fabio-maulo/nhibernate-chapter-11-interceptors-and/1nr4enxv3dpeq/14#
more docs here:
http://blog.scooletz.com/2011/02/22/nhibernate-interceptor-magic-tricks-pt-5/
Something like that:
public class TestInterceptor : EmptyInterceptor, IInterceptor { private readonly IInterceptor innerInterceptor; public TestInterceptor(IInterceptor innerInterceptor) { this.innerInterceptor = this.innerInterceptor ?? new EmptyInterceptor(); } public override object GetEntity(string entityName, object id) { if (id is string) id = id.ToString().ToUpper(); return this.innerInterceptor.GetEntity(entityName, id); } }
and register it freely as follows:
return Fluently.Configure() ... .ExposeConfiguration(c =>{c.Interceptor = new TestInterceptor(c.Interceptor ?? new EmptyInterceptor());}) ... .BuildConfiguration();