How to check if a state object is of type ICollection

I use the nhibernate interceptor to compare values of the old state and the current state of the entity properties but some of the properties are of type ICollection so could anyone guide me about how to check if an object is of type ICollection this

LINQ to Nhibernate user-defined function in the where clause

I'm trying to do the following: var query = (from a in session.Query<A>() where a.BasicSearch(searchString) == true select a); But it keeps giving me this exception "System.NotSupportedException"! Any idea how to solve this?It is not possi

NHibernate fluid Get HasMany elements in a single query

I have a Topic map which has many posts in it i.e- (At the bottom HasMany(x => x.Posts)) public TopicMap() { Cache.ReadWrite().IncludeAll(); Id(x => x.Id); Map(x => x.Name); *lots of other normal maps* References(x => x.Category).Column("

How to delete in a relationship several to many?

I have a many to many relationship: Product has many Categories and Category has Many Products. Say I have Shopping Category Food Category Product A - Shopping Category, Food Category Product B - Shopping Category Now I delete Shopping Category. I wa

NHibernate and Repository Template

What is the recommended approach to take with Nhibernate + Repository pattern? There are so many different articles and opinions around that I am not sure what path to take. Take this lengthy article, for example. It gives an example of Query objects

to use HQL to concatenate strings from multiple lines

Consider a table holding names, with three rows: Peter Paul Mary using NHibernate HQL I want to retrieve all the names as a single string "Peter, Paul, Mary" to put it inside a single DTO object field. is there a way to do this kind of concatena

Using DataAnnotations with NHibernate

In pursuit of finding the best way to have a date displayed on a Razor as just a short date, I have stumbled across Data Annotations, they seem quite nice being able to attach additional meta-data to my various models. Here's the catch though: I'm us

NHibernate criteria subquery help

I am using NHibernate and I my requirement is that I have 2 tables, User and Ticket. I want all the records that are in User but not in Ticket. The Ticket table has UserId as reference key to the Primary key ID of User table. Below is my code, RegNot

Why can timeout occur in SqlConnection.Open ()?

What are the cases when timeout occurs in SqlConnection.Open()? On one of our IIS boxes 10 seconds after AppProcess was recycled the following exception appeared: Type : System.Data.SqlClient.SqlException, System.Data, Version=, Culture=neutra

Nhibernat mapping aspnet_Users table

My User table I want to map to aspnet_Users: <class name="User" table="`User`"> <id name="ID" column="ID" type="Int32" unsaved-value="0"> <generator class="native" />

Apply native SQL where clause to Nhibernate query for entity

I have this problem. I have a module (module 1) that use Nhibernate to manage entity persistence; this module interacs with an other module (module 2). The "module 2" allows to generate dynamically native SQL where clause. Now I would use it to

Sqlite & ldquo; Not such a table & rdquo; when saving an object

Im trying to insert object into SQLite InMembory database as follow: private void button1_Click(object sender, EventArgs e) { var sessionFactory = CreateSessionFactory(); using (var session = sessionFactory.OpenSession()) { Person p = new Person { Ag

NHibernate Search in a list using ICriteria

I have my class X : public class ClassX { public virtual IList<ClassY> ListY { get; set; } ... } My ClassX mapping (using Fluent) ... HasMany<ClassX>(x => x.ListY ) .Inverse() .Cascade.AllDeleteOrphan() .KeyColumns.Add("`IDX`"); .

NHibernate Readonly Entities at runtime

I would like to know if there is a way to make an instance of an entity immutable at runtime. I know that I can have readonly types, but I would like readonly instances of types at runtime. Reason being, that I want to use NH domain objects like a li

Complex mapping of NHibernate components

EDIT: I simplified the problem to leave only what really bothers me. Hello all, I am trying to make the following mapping. In my database, I have a table called "ReportRowValue" containg the following columns: RowNumber ColumnNumber StringValue

NHibernate Set the default value of the property

Is it possible to set the default value of a property in NHibernate? Here is the scenario: I have a self join table Category. The class and table structure are as follows: Category int Id string Name Category ParentCategory Category int Id not null v

Mapping with NHibernate?

I have following classes in my domain model: public class Player { public virtual string ID { get; set; } public virtual string Name { get; set; } public virtual List<Match> Matches { get; set; } } public class Match { public virtual int ID { get; s

NHibernate connects and executes a query two times in a row

I am using: NHibernate, NHibernate.Linq and Fluent NHibernate on SQL Server Express 2008. I am selecting an entity using a predicate on a referenced property (many-one mapping). I have fetch=join, unique=true, lazy-load=false. I enabled the log4net l