nhibernate

SharpArchitecture: Using FNH's ClassMaps instead of auto mapping

I need to use ClassMaps instead of auto mapping because of legacy database. But I don't see how to tune SharpArch to use them. I tried to remove AutoPersistentModelGenerator and use the following code in the InitializeNHibernateSession method: var config = NHibernateSession.Init(webSessionStorage, ne...

MVC patterns with WPF + NHibernate + IoC

I'm looking for patterns and principles for using with WPF and NHibernate in model-view-controller style. ...

what is userthink time in hibernate

plz explain with an example.. Thanks .. ...

NHibernate many-to-many with composite element

Hello everyone. I encountered the following problem. In my application uses the entities Owner and Area binding as many to many. public class Area : DomainObject<int> { private ISet<OwnersPeriod> _owners = new HashedSet<OwnersPeriod>(); public ICollection<OwnersPeriod> Owners { get { return _owners; } s...

How to verify StructureMap is disposing of objects properly

I'm currently using StructureMap to inject instances of NHibernate ISessions using the following code: ObjectFactory.Initialize(x => { x.ForRequestedType<ISession>() .CacheBy(InstanceScope.PerRequest) .TheDefault.Is.ConstructedBy(y => NHibernateSessionManager.Instance.GetSession()); }); I'm assuming that the Ca...

Load vs Get in Nhibernate

The master page in my web application does authentication and loads up the user entity using a Get. After this whenever the user object is needed by the usercontrols or any other class I do a Load. Normally nhibernate is supposed to load the object from cache or return the persistent loaded object whenever Load of called. But this i...

How to integrate Windows Azure, Spring.NET and NHibernate?

Hi, we have a ASP.NET web application which makes use of NHibernate and Spring.NET (to do the session and transaction management stuff). Now we want to port parts of it to a Windows Azure application without making lots of changes to the used components. I already found this article of stackoverflow so I hope to get NHibernate running ...

ORM For .Net ON Oracle

I'm gonna start a new project soon, using .Net 3.5 and Winform on an Oracle database. We were planning on using an ORM. NHibernate was suggested by our architect. Since I'm personally more familiar with Entity Framework, I thought it would be easier to use than NHibernate. But since there isn't any official provision from Oracle, we are ...

Incorrect component when querying immediately after insert using NHibernate

I have the following mapping for my table in MySql: <class name="Tag, namespace" table="tags" > <id name="id" type="Int32" unsaved-value="0"> <generator class="native"></generator> </id> <property name="name" type="String" not-null="true"></property> <component name="record_dates" class="DateMetaData, namespace" > <property n...

Managing updates with NHibernate

I am aware that you can generate create scripts to generate database objects, but I am looking a way to generate an update script that compares two different schemas (two mapping files). That way I can provide my users with easy database updating from any version to the current version. Thanks! ...

nhibernate webforms with class library

I am very new to NHibernate, and am little confused on where features should live. I have the following solution 1) MyProject.Web (web forms application) 2) MyProject.Domain (class library) nhibernate.config product.hbm.xml So is it correct I should put the following method in a IHttpModule? ( i can't use a global asax as it's u...

Left Join on Many-to-One Mapping

I have a reference to call that may or may not be there. When I add the nullable option it still doing Inner Join when I want an Left Join (show the left even if the right is null). Is this possible in the NH map? References(x => x.DefaultCategory, "CATEGORY_ID") .Nullable(); ...

Colon ':' error - Not all named parameters have been set in Nhibernate?

I got a problem whenever I pass char ":" from the user interface. NHibernate mistakes it as a named parameter and throws an error, since there isn't any value for it. Exception is :- Not all named parameters have been set: [%] [SELECT COUNT (*) FROM Table t WHERE t.FirstName LIKE ':%' AND t.ID IN (38, 20)]" Is there any w...

Modelling Business Logic with NON-Techies

The setup: Winform/ASP.NET MVC projects. Learning NHibernate SQL-Server driven apps I work with clients that have no idea how to model an application. That's what I'm for. However, we have lots of conflicts with validation, mis-understandings, etc. For example, the client will ask for an order entry screen. The screen should require...

NHibernate transaction management in ASP.NET MVC - how should it be done?

I am writing a simple ASP.NET MVC using session per request and transaction per request patterns (custom HttpModule). It seems to work properly, but.. the performance is terrible (a simple page loads ~7 seconds). For every http request, graphical resources incuding (all images on the site) a transaction is created and that seems to delay...

NHibernate: Mapping multiple classes from a single table row

I couldn't find an answer to this specific question. I am trying to keep my domain model object-oriented and re-use objects where possible. I am having an issue determining how to provide a mapping to multiple classes from a single row. Let me explain with an example: I have a single table, call it Customer. A customer has several a...

Checking whether an object exists in StructureMap container

I'm using StructureMap to handle the creation of NHibernate's ISessionFactory and ISession. I've scoped ISessionFactory as a singleton so that it's only created once for my web app and I've scoped ISession as a hybrid so that it will only be opened once per web request. I want to make sure that at the end of each web request, I pro...

Getting Exception to Get record by ID using NHibernate

hello dear, I am new to Nhibernate, I am trying to get record by ID and I am getting exception Unknown entity class: DAL.Product here is my line of code where I am getting exception.. Repository.Get<Product>(id); What could be the issue? Thanks for your help. ...

Fluent nHibernate, mapping a composite primary key using an foreign key and an interface property.

Hi, I am having a problem in that the objects that I am using to map to nhibernate all implement an interface and on each interface any relationships with other objects are defined as an interface property. So given the following interface, public interface ISettingValue { int RoleId { get; } ISetting Setting { get; } st...

Mapping an instance of IList in NHibernate

I'm trying to map a parent-child relationship using NHibernate (2.1.2), MySql.Data (6.2.2) and MySQL Server (5.1). I figured out that this must be done using a <bag> in the mapping file. I build a test app which is running without yielding any errors and is doing an insert for each entry but somehow the foreign key inside the children ta...