nhibernate

How to use nhibernate with ASP.NET 3.5 (not MVC)

What is the best way to interop with NHibernate 2.0 and ASP.NET 3.5? How can I easily develop a CRUD application? Is the ObjectDataSource the way to go? Thank you. ...

(N)Hibernate Selecting Constants in Query

does anyone know if you can do something like this using the (N)Hibernate criteria api: Select 1 AS obj.Property0, obj.Property1, obj.Property2 from Class Baiscally I want to select a constant value for one of my properties in the query. I can do this easy enough using HQL but I was wondering if anyone knew a way using the criteria ap...

Using Additional Data on Intermediate Table with NHibernate

I'm working on a project that is used to input information about a product into a document. One section has a form that can be filled out as many times as needed for a particular product. The information on this form is then available to be shared on multiple related documents. A typical many-to-many situation. The difference is, on ...

NHibernate FK is a CHAR(6), and various queries fail due to the child table PK being CHAR(6)

I have a legacy Oracle database that has multiple 1:n lookup tables that are based on CHAR(6) primary keys in the child tables. Unfortunately, I'm not the only one who has problems with how NHibernate deals with char fields (especially with those as primary keys). See: http://forum.hibernate.org/viewtopic.php?t=984281 http://forum.hibe...

NHibernate.Caches.MemCache web.config for cache expiration time

I'm migrating to Nhibernate 2.0 GA but have some trouble with setting cache expirations in memcached provider. I see in the NHibernate.Caches.MemCache sources that there is a property for expiration and a default value for 300 seconds. There are also properties for cache regions but the config section handler does not seem to map them...

How good is NHibernate's BuildSchema?

I've been looking at NHibernate recently and trying to learn the ins and outs. One thing I did notice in a few articles was the use of BuildSchema to create a testable database. The particular example used SqlLite as the database. Can BuildSchema be trusted to create your database or is it still best to create your own Database Schema i...

What strategy should I take now that MS will no longer support LINQ to SQL?

Please if you have used NHibernate and Entity Frameworks, please contrast your experiences. ...

Select object when a property equals Max with NHibernate

We have a query that selects rows depending on the value of another, ie. the max. I don't think that really makes much sense, so here is the query: var deatched = DetachedCriteria.For<Enquiry>("e2") .SetProjection(Projections.Alias(Projections.Max("Property"), "maxProperty")) .Add(Restrictions.EqProperty("e2.EnquiryCode", "e.Enqu...

Call to Session.CreateSQLQuery ExecuteUpdate fails in NHibernate

I have a stored procedure that is used to synchronize data from another system through a linked server. I execute this call using NHibernate in a Windows Service that runs tasks using Quartz.net. One of these tasks is the synchronize data task and it is really just the sproc call: using(var tx = Session.BeginTransaction()) { Ses...

Oxite or S#arp Architecture for new Asp.net CMS site

I'd like to build a CMS site based on Asp.Net Mvc and I want to choose my starting point. I have seen that there is a lot of interest in the new Microsoft Oxite project also if it seems to be pretty early to adopt it in a production project. I've also looked at S#arp Architecture but it does not properly compare to Oxite as is just a st...

How do I make sure that there is one NHibernate ISession per request using Autofac?

I have the following code in an Autofac Module that is used in my Application_Start method: builder.Register(c => new Configuration().Configure().BuildSessionFactory()) .SingletonScoped(); builder.Register(c => c.Resolve<ISessionFactory>().OpenSession()) .HttpRequestScoped(); builder.Register<NHibernateSomethingRepository>().As...

NHibernate Transactions Best Practices

I have been reading about Nhibernate for a while and have been trying to use it for a site I'm implementing. I read the article by Billy McCafferty on NHibernate best practices but I did not see any indication on where is the best place to handle transactions. I thought of putting that code in the Data Access Object (DAO) but then I'm ...

How to save objects when approval is needed to actually make changes?

So I have an object graph, let's just say it's an order. You have the order class, line item class, tracking number class, payment class. You get the idea. Now the business requirement is any user can change the order, but order changes must be approved by the manager. Until the manger approves nothing changes. Managers can change anyth...

ASP.NET, Ninject and MVC: Performance Load problems

problem description: This model works fine with one user at a time. As soon as I get multiple users at once, I get a serious of errors relating to not closing my SqlDataReader. When i turn off lazy loading like this: persistenceModel.Conventions.OneToManyConvention = (prop => prop.SetAttribute("lazy", "false")); It's fine, yet perfo...

nHibernate Share References?

I'm getting a "Found shared references to a collection" exception when saving an object. Does anyone know what this means? ...

Is it possible to get a lazy IEnumerable from an NHibernate query using ICriteria?

I'm working with NHibernate and need to retrieve and process up to 2 million rows. Ideally, I could process each row - one at a time - without NHibernate loading all 2 million in memory at once (because, you know, that hurts). I'd prefer to get an IEnumerable which would call the data reader iteratively for each read so I could proce...

Is everyone here jumping on the ORM band wagon?

Microsoft Linq to SQL, Entity Framework (EF), and nHibernate, etc are all proposing ORMS as the next generation of Data Mapping technologies, and are claiming to be lightweight, fast and easy. Like for example this article that just got published in VS magazine: http://visualstudiomagazine.com/features/article.aspx?editorialsid=2583 Wh...

NHibernate session management in ASP.NET MVC

I am currently playing around with the HybridSessionBuilder class found on Jeffrey Palermo's blog post: http://jeffreypalermo.com/blog/use-this-nhibernate-wrapper-to-keep-your-repository-classes-simple/ Using this class, my repository looks like this: public class UserRepository : IUserRepository { private readonly ISessionBuilder...

How to update database table schemas with NHibernate schema generation?

I'm trying to figure out how to use NHibernate configuration with mapping to update table schemas, rather than dropping and recreating them. Currently I'm using the NHibernate.Tool.hbm2ddl.SchemaExport obj with FluentNHibernate to generate the database schema for a mysql database. While I can't say it's a huge problem, whenever I call ...

NHibernate child objects update problem

I have an object that called 'category' and the table looks like this. CATEGORY ID int ParentCatalogID int ParentCategoryID int << This is the ID of this table Position int Title nvarchar(128) Description nvarchar(1024) LastUpdated datetime DateCreated datetime IsActi...