fluent-nhibernate

NHibernate Joined Subclass in Separate Assemblies

I have the following solution project structure: Application.Core.Entities Application.Xtend.CustomerName.Entities In the Core project I have an entity Customer defiend. In the XTend project, I have an entity defined that subclasses Customer named xCustomer (for lack of a better name at this time...). The idea here is that w...

Does Fluent-NHibernate support mapping to procedures?

I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects. Also is Fluent-NHibernate able to directly execute procedures with no result set returned? Basically I've been considering the implications of using Fluent...

Fluent NHibernate - how to map a subclass one-to-one?

Suppose I have three classes. It is valid to instantiate A, but there are also special cases B and D which subclass A, adding additional information. How would I do the mapping files for this in (fluent) NHibernate? public class A { public int ID { get; set;} public string CommonProperty1 { get; set; } public string Common...

Fluent NHibernate: How to create one-to-many bidirectional mapping?

Hi, Basic question: How to I create a bidirectional one-to-many map in Fluent NHibernate? Details: I have a parent object with many children. In my case, it is meaningless for the child to not have a parent, so in the database, I would like the foreign key to the parent to have NOT NULL constraint. I am auto-generating my database f...

NHibernate: Best way to deal with intermediary table using Fluent NHibernate?

How would you map the following in Fluent NHibernate? See "18.3. Customer/Order/Product" http://www.hibernate.org/hib_docs/nhibernate/html/example-mappings.html ...

Odd Exception when Combining .hbm.xml and Fluent NHibernate - Any ideas?

So I'm converting my mapping files on an as needed basis (when making changes, convert to mapping). Any when configuring NHibernate like so: Assembly asm = Assembly.Load("RPMWare.Core.DataAccess"); //NHibernate configuration: see hibernate.cfg.xml var cfg = new Configuration(); cfg.AddMappingsFromAssembly(asm); cfg.Configure(); And r...

Is the default behavior with Fluent NHibernate to lazy load HasMany<T> collections?

when I am setting up my fluent mappings, what is the default for collections? Do I need to explicitly set them as lazy-load, or is that the default? ...

Fluent NHibernate, joined-subclass mapping

I'm trying to map a joined-subclass scenario using Fluent NHibernate. I have a class Entity defined in the namespace Core, and a class SubClass : Entity in the namespace SomeModule Now I obviously don't want class Entity to know about its derived types, the SomeModules namespace references Core - not the other way around. All the examp...

Can this mapping be done with (Fluent) NHibernate?

I have an Events table whose goal is to store actions done by web site users. An action basically alters or create a new row in a table X. This will allow me to store an history of all actions done by a user. As such, Events contains: a primary key column a text to describe the event (ex: "posted a comment") a discrimator column if nee...

NHibernate mapping with a class hierarchy whose base class is abstract and the discriminator is not a string

Here are the domain model classes: public abstract class BaseClass { ... } public class ChildClass : BaseClass { ... } Note that the parent class is abstract and this is what gives me some difficulties when comes the time to map with fluent nhibernate. My discriminator is a byte (tinyint in the DB). Because it is not a string and I c...

How do I do TDD efficiently with NHibernate?

It seams to me as most people write their tests against in-memory, in-process databases (like SQLite) when working with NHibernate, which is fine. I have this up and running but my first test (that uses NHibernate) always takes between 3-4 seconds to execute, next test runs much faster. I am using FluentNhibernate to do the mapping but ...

How to build Fluent NHibernate?

I want to take a look on Fluent NHibernate but unfortunately I cannot find any information on how to build it from the sources. Maybe someone can help me? What tools I need for building it? ...

How to test fluent-NHibernate's PersistenceSpecification.VerifyTheMappings with lists and relational objects?

How would you test this scenario? I've just started looking into NHibernate and having my first bash at TDD. So far I've really enjoyed it and have been using fluent-Nhibernate for my mapping of the classes. However I seem to be hitting a dead end when it comes to using the VerifyTheMappings method on PersistenceSpecification. Essenti...

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...

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 ...

Could we have custom name of the primary key column in Fluent NHibernate?

I'm so surprise while I'm working in Fluent NHibernate. I got my legacy database that has primary key column name is different from my property in domain model. I'm sure that I can use this mapping file: <class name="Person"> <id name="Id" column="CommentId"> <generator class="native"/> </id> <property name="Description" typ...

using (Fluent) NHibernate with StructureMap (or any IoCC)

Hi, On my quest to learn NHibernate I have reached the next hurdle; how should I go about integrating it with StructureMap? Although code examples are very welcome, I'm more interested in the general procedure. What I was planning on doing was... Use Fluent NHibernate to create my class mappings for use in NHibs Configuration Implem...

How to map to get value from primary table in Nhibernate?

I face a problem when I try to get value from primary table in my mapping file. My tables: CREATE TABLE Customer ( [CustomerId] INT PRIMARY KEY, [FullName] NVARCHAR(50) NOT NULL ) CREATE TABLE CustomerOrder ( [CustomerOrderId] INT PRIMARY KEY, [CustomerId] INT, [TransactionDate] DATETIME ) My classes: public cla...

fluent nHibernate mapping

I am working on a legacy system and have introduced fluent nHibernate but have one last mapping that I can not seem to get working. Code: public class Permit { public int PermitId { get; set; } public char Discipline { get; set; } public PermitDetails PermitDetails { get; set; } } public PermitDetails { pub...

NHibernate not persisting many-to-many relationship

Hello, I'm currently using NHibernate as my data access layer, using Fluent NHibernate to create the mapping files for me. I have two classes, TripItem and TripItemAttributeValue, which have a many-to-many relation between them. The mapping is as follows: public class TripItemMap : ClassMap<TripItem2> { public TripItemMap() { ...