nhibernate

Nhibernate 2.0.1 with mono

I've build my WinForm app on windows machine and the app is working ok. When I user nhibernate 1.2.1 the app also worked on linux machine using mono, but now when i upgraded app to nhibernate 2.0.1 it works only in windows. I've get error: NHibernate.InvalidProxyTypeException: The following types may not be used as proxies: xxxx.Data.Da...

NHibernate mapping to another object NOT on the ID

Ok, NHibernate question here. I have two objects that I would like to map to each other. I have the "Vendor" and the "Township" ... now the two should be linked by zip code, NOT ID. I have done this many times btw objects using id's but never something like this. The issue I am having it that the ZipCodes while stored as strings are so...

Have you ever used CSLA?

Have you ever used CSLA and if so what are yout thoughts? I am starting a new contract for a company that uses CSLA and NHibernate and wanted some opinions or insights into the framework. ...

Domain Driven Design - Logical Deletes

So, I have a nice domain model built. Repositories handle the data access and what not. A new requirements has popped up that indicates that reasons need to be logged with deletes. Up until now, deletes have been fairly simple => Entity.Children.Remove(child). No internal change tracking was happening as my ORM tool was handling stat...

Tool for generating C# classes from NHibernate mappings files?

What tool is there for generating C# classes from NHibernate mappings files? ...

NHibernate bidirectional many-to-many association

Hello. I have a class with following description: public class Customer { public ISet<Client> Contacts { get; protected set;} } I want to map Contacts property onto following table: CREATE TABLE user_contacts ( user1 uuid NOT NULL, user2 uuid NOT NULL ) I want it to map bidirectionally, i.e. when Customer1 added to Cust...

NHibernate database connections failing under load

Hi, I was wondering if this seemed to familiar to any experience NHibernate developers or if someone could give me an idea as to where to start to try and resolve this issue: I inherited an NHibernate site written in ASP.NET 1.1 using NHibernate 0.6 and .NET remoting to the DAL layer residing on the database server. I have been trying ...

NHibernate DetachedCriteria.SetFirstResult?

I found an example of implementing the repository pattern in NHibernate on the web, and one of the methods uses this code to get the first result of a query: public IEnumerable<T> FindAll(DetachedCriteria criteria, int firstResult, int numberOfResults, params Order[] orders) { criteria.SetFirstResult(firstResult).SetMaxResults(numb...

Problem using SQLite :memory: with NHibernate

I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the :memory: option. When I fire up any of the integration tests, the database seems to be created (NHibernate spits out the table creation sql) but interfacting with the database c...

NHibernate Order By question

Ok, so I have an nHibernate ICriteria that returns an object. I want to order by a single property but NOT asc or desc I want certain values of the property to come to the top of the repeater based on the selection. Like if I choose "video" I want all records with videos to come to the top. Now, can I do this in the query? or the repea...

NHibernate Criteria: concatenating two columns with an IN Expression

This is the SQL that I want to accomplish: WHERE domain_nm + '\' + group_nm in ('DOMAINNAME\USERNAME1','DOMAINNAME2\USERNAME2') I can't for the life of me find an appropriate Expression for this. And I don't think I can use two expressions as the domain name and the group name need to be concatenated. Thanks! ...

How to save a PDF file Using NHibernate and SQL Server 2005

I'm developing a webapp where the user is given the chance to upload his resume in pdf format. I'm using NHibernate as a data mapper and MS SQL SERVER 2005. I want to be able to save the .pdf file to a given table... any ideas? Thank you very much! ...

Are there good reasons not to use an ORM?

During my apprenticeship, I have used NHibernate for some smaller projects which I mostly coded and designed on my own. Now, before starting some bigger project, the discussion arose how to design data access and whether or not to use an ORM layer. As I am still in my apprenticeship and still consider myself a beginner in enterprise prog...

Multiple deletions using LINQ (more specifically Linq2Nhibernate, but...)

Is there any smart way to do this? If using Linq2Nhibernate, you really seem to have to rely on HQL or the likes to do multiple deletes from a database (without loading up and deleting one by one)? It doesn't seem like Linq2Sql have it either? I just want something that can do stuff like: DELETE FROM Accounts WHERE amount < 1000 Any...

Bidi associations and NHibernate mapping

I have classes BidiParent and BidiChildList which link parents and children in a bidirectional parent-child relationship. If a child's parent is updated by e.g. the service layer, the old and new parents' children lists are automatically updated to reflect the change. Likewise, if a parent's children list is updated by e.g. adding a new ...

How to tell NHibernate always to force quoted identifiers?

As the title: How would I tell NHibernate, once and for all, that all table and column names are to be quoted in the SQL it generates? ...

Persistence framework?

I'm trying to decide on the best strategy for accessing the database. I understand that this is a generic question and there's no a single good answer, but I will provide some guidelines on what I'm looking for. The last year we have been using our own persistence framework, that although limited has server as well. However it needs some...

What's the best way to get aggregate results from NHibernate?

For example, I am trying to get a min date, a max date, and a sum in different instances. I am trying to avoid hard coding a SQL string or looping through an IList to get these values. ...

Are code generators bad?

I use MyGeneration along with nHibernate to create the basic POCO objects and XML mapping files. I have heard some people say they think code generators are not a good idea. What is the current best thinking? Is it just that code generation is bad when it generates thousands of lines of not understandable code? ...

NHibernate: uninitialized proxy passed to save() and cascade

Hi, I keep getting an NHibernate.PersistentObjectException when calling session.Save() which is due to an uninitialized proxy passed to save(). If I fiddle with my cascade settings I can make it go away, but then child objects aren't being saved. The only other fix I have found is by adding the following to my DefaultSaveEventListener...