nhibernate

Multiple SessionFactories in Windows Service with NHibernate

Hi all, I have a Webapp which connects to 2 DBs (one core, the other is a logging DB). I must now create a Windows service which will use the same business logic/Data access DLLs. However when I try to reference 2 session factories in the Service App and call the factory.GetCurrentSession() method, I get the error message "No session ...

NHibernate and .net-4.0 new ISet<T> collections

I there any new use of the new .net 4 ISet collections with NHibernate? ...

NHibernate correct way to reattach cached entity to different session

I'm using NHibernate to query a list of objects from my database. After I get the list of objects over them I iterate over the list of objects and apply a distance approximation algorithm to find the nearest object. I consider this function of getting the list of objects and apply the algorithm over them to be a heavy operation so I cach...

Access one database from multiple ORMs :: Caching issue

I know this is not a good idea and the best would be to let the applications talk Web Services. But I have a situation where the legacy application is accessing a database with an ORM and I need to access the same database from the new .net application using Fluent nHibernate. So the question is what problems this will make and how to s...

Any exprience with Castle ActiveRecord?

Hi all, I was searching for a light data access framework based on NHibernate. I needed simple CRUD and some simple HQL or LINQ-to-NHhibernate queries. Performance was not an important issue and applications which I'm working on have simple table structure but many tables. This data access framework is going to be used in a ASP.NET Webf...

application authentication design ideas

Hello I am working with on an app that uses wpf / silverlight on the front end and nhibernate on the back end, and looking for some design ideas to address authentication; I was looking at Rhino Security which I think is pretty slick and certainly useful, but doesn't in and of itself seem to address authentication. That said, I am loo...

NHibernate - Is there a way to prevent version increment?

For performance reasons, sometimes I want to update entities without any version increment(or version check). With LINQ TO SQL, I just left the version unchanged and it worked fine. Is this behavior possible in NHibernate? ...

NHibernate Criteria - How to filter on combination of properties

I needed to filter a list of results using the combination of two properties. A plain SQL statement would look like this: SELECT TOP 10 * FROM Person WHERE FirstName + ' ' + LastName LIKE '%' + @Term + '%' The ICriteria in NHibernate that I ended up using was: ICriteria criteria = Session.CreateCriteria(typeof(Person)); criteria.Add(...

Un able to run MSTest Tests with code coverage enabled while using NHibernate

i'm unable to run MSTest Tests with code coverage enabled while using NHibernate i get the following error message Unit Test Adapter threw exception: Type is not resolved for member 'NHibernate.Cfg.HibernateConfigException,NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'.. edit : Same thing...

Spring.Data.NHibernate12:::Application not closing database connection(Getting max connection pool size reached)

Even after successful transaction.Application connection with the database persist.in Hi , I am using Spring.Data.NHibernate12 on my database level.my application connection with database is not getting released. Underneath given is Dataconfiguration.xml <?xml version="1.0" encoding="utf-8" ?> <objects xmlns="http://www.springfra...

NHibernate complex one-to-one mapping

There is a table A containing common unversioned data for entities. There are also tables B,C,D with versioned data of particular entity type. All of these tables are referencing table A. The task is to add a mapping of a property of entity's type, for example, stored in table B, which would reference table A, and specify a rule how ent...

A storage mechanism has already been configured for this application

I am getting this error whenever my S#arp Architecture attempts to start and this is an problem with SQL Server (for example: SQL Server is not runing), after I start SQL Server and hit refresh, I get this error: A storage mechanism has already been configured for this application ...

Accessing the Identity object in a MVC repository

Hi, I have a pretty generic repository that does basic CRUD for many of my business entities. The entities enherit form a generic object that has a few fields I maintain for all objects. eg. ModifiedBy, CreatedBy, CreatedDate, ModifiedDate. These fields ModifiedBy and CreatedBy will always be set before any update/save. My questions is...

NHibernate - using custom sql query for a column

Is there any way to use custom sql with NHibernate? I want to use a complex sql for a specific column. Example: select id, viewsCount, commentsCount, 0.2 * viewsCount / (select top 1 viewsCount from articles where isActive = 1 order by viewsCount DESC) as priorityViews, 0.8 * commentsCount / (select top 1 commentsCount from artic...

NHibernate. Distinct parent child fetching

Hello. I've got common NH mapping; <class name="Order, SummaryOrder.Core" table='order'> <id name="Id" unsaved-value="0" type="int"> <column name="id" not-null="true"/> <generator class="native"/> </id> <many-to-one name="Client" class="SummaryOrderClient, SummaryOrder.Core" column="summary_order_...

NHibernate. DTO -> Domain

Hello guys. I've got SOA which processing data for diff clients(asp,sl). The base of this design is domains of my business model. For transporting,showing it to clients I use DTO. For mapping domain to DTO I use AutoMapper. Now I should persist new entities from clients. I want use my DTO's at this scenario too. So i've got some questio...

NHibernate.Linq : session becomes dirty after select

I have a simple NHiberntate linq query: var queryable = session.Linq<Product>().Where(p => p.Active); Product[] products = queryable.ToArray(); The moment the ToArray() is executed the session becomes dirty (session.IsDirty() returns true). If the transaction is commited there is an UPDATE SQL query generated for each product. Why ar...

How can we add IntelliSense to visual studio in time of nhibernate mapping file editing?

How can we add IntelliSense to visual studio in time of nhibernate mapping file editing? ...

How to find unmapped properties in a NHibernate mapped class?

I just had a NHibernate related problem where I forgot to map one property of a class. A very simplified example: public class MyClass { public virtual int ID { get; set; } public virtual string SomeText { get; set; } public virtual int SomeNumber { get; set; } } ...and the mapping file: <?xml version="1.0" encoding="utf...

How can i do something like IList<T>.Contains(OtherObjectType) ?

Hi, I have the following classes: Client ClientCacheMedia ( contains Client, Media and some other parameters so it is the link between the media and the client) Media where client contains an IList. Now what i would like to do, is have a way to check if this ilist contains a certain media so : Client.ClientCacheMedia.Contains(MyMed...