nhibernate

How to scope NHibernate sessions and transactions in a WPF application

I am relatively new to both WPF and NHibernate and attempting to build an application that combines the two, using the MVVM pattern. However, I am struggling to understand when and where my application should open and close NHibernate sessions and transactions. From what I have read, it is recommended that sessions should be kept as sho...

How to persist anonymous types instances through NHibernate?

Instinctively, I would say that this is impossible, as NHibernate needs to know some mapping information on how to persist a given type. Thus, I encountered some situations in which I could use such a feature. For instance, through a named query or something like so. On the other hand, using a named query would require me to make an addi...

Passing my own ConnectionString in Castle Active Record

How can I inject my own ConnectionString if using Castle Active Record? ...

Modeling an organizations hierarchy then been able to map details of each different organization in Nhibernate

We are trying to model a school system hierarchy from State>County>District>School, hence we are using the model below to describe the parent child relationship along with organization type (i.e. School, District,…). Organization Hierarchy Now we need to store details on each particular organization, for example if it’s a school we n...

How to map IDictionary<string, Entity> in Fluent NHibernate

Possible Duplicate: Use Component as IDictionary index in AsMap in Fluent Nhibernate Hi, I have an class with an IDictionary on it. <map name="CodedExamples" table="tOwnedCodedExample"> <key> <column name="OwnerClassID"/> </key> <index type="string" column="ExampleCode"/> <many-to-many class="CodedExa...

Wrong login used when using ASP.NET and NHibernate

I have an ASP.NET v2 website which uses NHibernate for ORM. My current architecture is not that great and I will be changing it after reading some best practices but I wish to still try and figure out my current problem. I have a login screen which creates a ISessionFactory with the connection string set appropriately to the user name ...

How can I generate subclass joins in a NHibernate SqlQuery?

I am having problems getting NHibernate to generate a SQL query that actually runs without errors, as the query is missing joins for my subclasses. Lets take this minimal example: class Page { public virtual int Id { get; set; } public virtual string UrlSegment { get; set;} public virtual Page Parent { get; set; } } class ...

Entity, Value Object or what is it and where it should be?

I have class called 'Tool'. Tool has properties like: Name, Description and some specific others. Tool is special because Name and others are read only but description can be modified by users. Count of tools is constant and known at development time. It is not Value Object because I need to query them and show to users where they can u...

Is LINQ-to-NHibernate ready for production code ?

Simple question: Is LINQ-to-NHibernate stable and feature-complete enough to be used for production code ? What are the limitations ? NOTE : I am aware that this is a duplicate of this question, but the last answer is over a year old, so the answers might or might not be relevant any longer. ...

Shared Cache Provider for NHibernate

What's best shared cache provider for NHibernate ? Providers pros & cons are welcome ! ...

Is NHibernate Contrib still alive?

I don't found they repository, and here I don't see any questions about it. Is this project still alive? Does anyone use it? ...

NHibernate projection: How to get a typed type using the Criteria API with projection

List<object[]> products = GetSession().CreateCriteria<Product>() .SetProjection(Projections.ProjectionList() .Add(Projections.Property("Id")) .Add(Projections.Property("Name")) .Add(Projections.Property("Price")) ) ...

What is the difference between Nhibernate and SubSonic ?

I know that NHibernate is a very powerful ORM but SubSonic is not known for me. please give me a little information about SubSonic and tell me that What is the difference between Nhibernate and SubSonic ? ...

How to use 2nd Level Cache with NHibernate.Search

How to use 2nd Level Cache with NHibernate.Search ? I tried to enable SetCacheable on FullTextQuery, but it doesn't work. var session = Search.CreateFullTextSession(database.Session); session.CacheMode = CacheMode.Normal; var textQuery = session.CreateFullTextQuery(query, new[] { typeof(Job) }); textQ...

NHibernate ICriteria search

I have the following criteria search that I would expect to return 1 project with multiple task and contexts and a single user. What is actually getting returned is the same project multiple times for each different task. It almost looks like I am missing a statement in the criteria to tell the search to return unique projects. Any he...

join 3 icriteria with or

Is it possible to join 3 ICriteria together with OR statement not AND? ICriteria criteriaCity = NHibernateSession.CreateCriteria(typeof(Advertisements)) .CreateCriteria(AdvertisementsProperties.City.ToString(), "city"). Add(Restrictions.Or( Restrictions.Like("city." + CitiesProperties.Name.ToS...

Castle Project Active Record or Fluent NHibernate

We've been looking at using an ORM at work. Currently we are trying to way up the pro's and con's of fluent nhibernate against castle active record. We are unsure of the flexibility of each as our database isn't very conventional. It lacks foreign keys and identities on the primary keys (A little confusing but the next value is stored ...

Querying a bit field with nHibernate

Hi, Using SQL Server 2005 I have a table that contains a bit field. When the table is viewed, the console automatically translates this to true/false. So I'm trying to query this with nHibernate to match all records for which this field is "true", like this: Dim results As ArrayList = session.CreateCriteria(Of DataTransferObjects....

NHibernate Ordering more than 2 joined fields of a class.

Hi guys, I would like to ask on how you do ordering on an object with 2 properties that are basically joined from 2 entities. Lets say "ClassA" has a property named ClassB and ClassC which are also classes themselves. ClassB has a property named Name and ClassC also has a property named Name. Now, since ClassB and ClassC are both proper...

Easiest way to reindex lucene.net indexes when nhibernate.search used?

Context => Calling wcf, some random stored procedures and sql stuff theoretically imports some data. Requirements => Reindex lucene indexes for some of imported entities. Question => What's the easiest way to do that? Theoretically, if nhibernate is initialized, nhibernate.search should be aware which entities are supposed to be ind...