fluent-nhibernate

Asp.net MVC - How to achieve flexible modules to be used cross-project?

Hello, I´m not looking for code directly, but for some ideas how to solve my problem the best. There is this asp.net mvc application I´m working on. It should be "highly modular" and many parts have to be reused across different projects. Our current approach is using the Managed Extensibility Framework to import assemblies at runtime...

FluentNHibernate: Nested components in a One to Many relationship

I can have a nested component on a one to one like this: Component(a => a.XPTO, m => { m.Map(xpto => xpto.X, "X").Not.Nullable(); m.Component(xpto => xpto.Y, m2 => { m2.Map(y=...

Fluent NHibernate SetBatchSize method

I'm using NHibernate Profiler to see if batching really occurs. Code looks like this Session.NHibernateSession.SetBatchSize(data.Items.Count); foreach (var o in data.Items) { //something else... base.Save(o); } Session.NHibernateSession.SetBatchSize(0); Profiler still gives me error "Large number...

FluentNhibernate HasMany with component

i have this mapping: HasMany<ClassA>(ot => ot.AList) .Table("XPTO") .KeyColumn("IDXPTO") .Component(m => { m.Map(a=> a.X, "X"); m.Map(x=> x.Y, "Y"); }) .Cascade.AllDeleteOrphan(); i get an error ...

Why Fluent NHibernate vs. hbm XML files?

While this is a subjective question, as a new NHibernate user, I'm curious as to why one would choose Fluent vs traditional XML mapping. From my standpoint, when I first worked with NHibernate, I used the Fluent interface, but ran into some roadblocks and had a hard time finding adequate documentation for the Fluent interface for anythi...

Fluent-NHibernate : how to map one-to-many relationship into 3 tables (many-to-many, kinda)

I have to 2 entities like this: class A { int id { get; set; } string Name { get; set; } } class B { int id { get; set; } A RefToA { get; set; } string Name { get; set; } } How can I map this 2 classes so that i would have 3 tables like this: table A with 2 columns: id and name table B with 2 columns: id and name t...

"No persister for" error with NHibernate, NHibernate.Linq and Fluent Mapping

Hi, I´m using Nhibernate 2.1.2.4000 GA with Nhibernate.Linq 1.0 and latest version of FluentNhibernate downloaded from master on github. Im doing some tests and whenever I try to delete a entity retrieved by a linq query i´m getting this error: No persister for: NHibernate.Linq.Query`1[[Employees.Core.Entities.Employee, Employees.Core...

nhibernate mapping: A collection with cascade="all-delete-orphan" was no longer referenced

Hi All I am having some probs with my fluent mappings. I have an entity with a child collection of entities i.e Event and EventItems for example. If I set my cascade mapping of the collection to AllDeleteOrphan I get the following error when saving a new entity to the DB: NHibernate.HibernateException : A collection with cascade="all-...

How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console?

How to configure Fluent NHibernate to output queries to Trace or Debug instead of Console? I'm using MsSqlConfiguration.MsSql2008.ShowSql() but it has no parameters and I can't find anything on Google. ...

How to map part of aspnet_Users table using Fluent NHibernate

I'm trying to get Fluent NHibernate 1.0 RTM to map a User entity for me so that I have access to UserId and UserName inside my ASP.NET MVC application via NHibernate. I have: public class User { public virtual Guid UserId { get; protected set; } public virtual string UserName { get; protected set; } } It represents the aspnet...

Fluent NHibernate : How can i use Int64 as ID?

Hi guys, I'm quite new to the whole concept of ORM, NHibernate and FluentNH, and i'm trying to accomplish something that seems so simple... I'm trying to retrieve an object that has a field defined as Int64 in it's class. This field would be the ID, as defined in the Map file. When trying to retrieve a record from the DB, NHibernate r...

Alternatives for NHibernate mappings?

Are there any good alternative to NHibernate's xml mappings? I have seen Fluent. All I look for is high maintainability. UPDATE : I would like to know the performance issues related with using fluent because I guess it is going to create xml mappings from the class (which can be time consuming - my guess) Thanks ...

Fluent Nhibernate and MVC

I am trying to do a MVC project where i want to use fluent nhibernate. gonna use sql. unfortunately i am confused about how to even start it. i found no tutorials in the net. i need help in organizing my project.thanks in advance ...

NHibernate Design For WinForms

How should I have the NHibernate Session Factory and the sessions for a WinForms application? Should the SessionFactory be a singleton? Or can I create it every time? What about sessions and transactions? Any help would be appreciated. Thanks ...

LINQ to NHibernate can't get to children's children

I have entity A which has an IList of B called Bs and B has an IList of C called Cs. I want to search for all A's which have at least 5 C's in them. So I went and wrote using (var s = this._sessionFactory.OpenSession()) { IQueryable<A> q = s.Linq<A>(); // some code... if (range.Min.HasValue) q = ...

Virtual property with private set

I am trying to use fluent nhibernate in a MVC project... i am very new to nhibernate and fluent... It seems the entities should have properties that are virtual and the set should be private for IDs... i use vb language...so tried using overrideable...it gives an error... Public Overridable Property DesignId() As Integer Get En...

fluent nhibernate Exception error

am trying to implement fluent nhibernate in MVC project...there were no build errors... but when i run the project i get this exception System.Xml.Schema.XmlSchemaValidationException: The element 'class' in namespace 'urn:nhibernate-mapping-2.2' has incomplete content. List of possible elements expected: 'meta, subselect, cache, synchro...

NHibernate: Unable to cast PersistentBag...

This question was asked back in October (unable-to-cast-object-of-type-nhibernate-collection-generic-persistentgenericbag). Basically, I have a POCO that has a one-to-many relationship modeled by a List<ChildType>. When you try to get it/save it in NHibernate you get a type cast exception saying it's trying to cast from NHibernate.Colle...

Fluent NHibernate: How to Map M:N many-to-many with composite keys on both sides

OK, so here is the problem. Its not even as crazy as the guy who wants to map m:n with different column counts in his PKs. No matter what I do or where I look there seems to be no method chain that will result in a successful mapping of this. I have tried doubling up on the Parent and Child columns, eg ParentColumn("").ParentColumn(""...

Fluent NHibernate Many-to-many mapping with auto-generated pk instead of composite key

I'm working on a RoleProvider in .NET, using Fluent NHibernate to map tables in an Oracle 9.2 database. The problem is that the many-to-many table connecting users and roles uses a primary key generated from a sequence, as opposed to a composite key. I can't really change this, because I'm writing it to be implemented in a larger exist...