Category: Open Source

Using LIKE with LINQ to NHibernate in C#

NHibernate Benjamin Perkins

The equivalent to LIKE via the LINQ to NHibernate provider is Contains. An example of a LINQ to NHibernate that will return a result set matching a search like parameter is below. IQueryable<Classname> linqLIKE =         (from m in session.Query<Classname>()          where m.Code.Contains(“%dex%”)          orderby m.CreateDate          select m); IList<Classname> ListLIKE = linqLIKE.ToList(); The above […]

Read More →

NHibernate mapping experience with an ambiguous reference

NHibernate Benjamin Perkins

Sometime things don’t always go as planned. I was making some nice progress with the process of mapping a database and all of a sudden I get the following compile time error message. Ambiguous type reference. A type named “Attribute” occurs in at least two namespaces. “Attribute” ist ein mehrdeutiger Verweis und kann “System.Attribute” oder […]

Read More →

Inserting Parent Child records using NHibernate IDENTITY INSERT OFF

NHibernate Benjamin Perkins

One of the errors I received when I was trying to get the parent child insert to work with NHibernate was: Ein expliziter Wert für die Identitätsspalte kann nicht in der ‘CHILD’-Tabelle eingefügt werden, wenn IDENTITY_INSERT auf OFF festgelegt ist Cannot insert explicit value for identity column in table ‘IdentityTable’ when IDENTITY_INSERT is set to […]

Read More →