nhibernate

fluent / nhibernate mapping question

Hey Guys I would very much appreciate some help with the following. We're using fluent to control the mappings for nhibernate and its all gone well so far. We've basically got a scheduled based CMS system and I'm having problems using the HasMany mapping to exclude the non-live child categories. So we have the following Data Tables, s...

Mapping a single class to columns in two tables with Fluent nHibernate

I have the following database tables: TABLE dbo.Client ( ClientId PK uniqueidentifier , ClientNames VARCHAR(200) ) TABLE dbo.User ( userID PK UniqueIdentifier, password varchar(15), passwordsalt varchar(15), ClientID FK uniqueidentifier ) I want to map them to my class: public class Client { public virtual Guid Id {...

NHibernate.Linq - Custom/Calculated property expression

How can a domain object include a property that calculates a value from other database mapped properties so that the calculated property can be used in both the domain object instance and the db level by nhibernate.linq. I would like to be able to use the property when working with the object directly: Console.WriteLine(Entity.Calculat...

NHibernate cascade and generated guid ids - why are they not generated for the children on save?

I do the following: var @case = new Case { Name = "test" }; // User is persistent and loaded in the same session User.AddCase(@case); // sets @case.User = User too Session.Update(User); response.CaseId = @case.Id; The cascade on User.Cases is set to All. But @case.Id is not set until the transacti...

NHibernate: If two calls are made to CreateCriteria, which list is Get<T> going to retrieve the object from?

Under one UnitOfWork (session) I may call CreateCriteria twice. My first call is to populate a grid for data editing. Let's say the data has been edited and flushed (saved) to the database and the grid is still open. After the data is edited, I may call CreateCriteria a second time to retrieve a list of objects that are validated and fou...

a good profiler for nhibernate logs ?

Hi I have a web application with nhibernate talking to the database. The application is running very slow due to lot of chatty db calls that nhibernate is doing. I want to run a profiler or something similar that can give some stats example number of db trips. table names and times accessed. I saw one of the products called nhprof ...

NHibernate Mapping a Collection with a Discriminator

Let's say that I have a class/table called Images that, as it stands right now, is bound in a manner similar to this: <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="Domain.Image, Domain" table="Images"> <id name="id" column="ImageID" access="field" unsaved-value="0"> <generator class="identity" /> </...

NHibernate linq - Use lambda expression in place of formula attribute on mapping.

NHibernate has an attribute on the property element in the mapping config named "formula" that allows the injections of sql to "calculate" a property. The issue I have is the formula using sql syntax directly. Is there a way to have nhibernate.linq to use a lambda expression instead of using the formula property. I have the following: ...

Alternatives for NHIbernate?

HI all, What all other libraries or frameworks we can use apart from NHIbernate? Can linq work with entites as the NHIbernate does? Can linq automatically generates entities for us? Does the Data application block come with .NET 3.5 or some separate installation is required? ...

Is NHibernate.Spatial compatible with NHibernate 3.0?

I want to use NHibernate.Spatial. I also want to use new NHibernate 3.0 features such as the improved LINQ provider and the QueryOver functionality, which are only available in NHibernate's source control trunk. Are these two things compatible? I can't work without Spatial but I really want the LINQ features, which will have to go if th...

looking for some books about asp.mvc and nhibernate

Hi i'm looking for some books about asp.net and nhibernate. Any suggest? thanks ...

What are the major differences between Data Access Application Block, NHibernate, ADO.NET Entity Framework and LINQ to SQL?

What are the major differences between Data Access Application Block, NHibernate, ADO.NET Entity Framework and LINQ to SQL with respect to performance, business logic, scalability and flexibility? ...

NHibernate's out of the box features.

How does NHibernate provide out of the box features as compared to the other OR/M tools available like ADO.NET entity framework and LINQ to SQL? ...

Fluent NHibernate join single column from another table

Hi, I'm using Fluent NHibernate and have two tables; Customer [ID, Name, LanguageID] Languages [ID, Description] I have a Customer entity with the following properties; ID, Name, LanguageID, Language What I would like to do is to join to the Languages table to get the language description and put it in the language property of the c...

Where clause in Fluent NHibernate Many-to-Many

I am trying to setup a many-to-many mapping in Fluent Nhibernate that has a where clause attached to the child table. This is basically how it should work: HasManyToMany(p => p.Images) .Table("ProductImages") .ParentKeyColumn("ProductID") .ChildKeyColumn("ImageID") .Where("ImageTypeID = 2"); The ImageTypeID column is in the I...

NHibernate: How to map a relationship represented by a range?

I have a class (Person) that contains an int property (Foo). Another class (FooRange) contains records representing possible ranges of Foo, with high and low boundaries in each row. Think of Foo as a 1 - 100 number and FooRange containing 10 rows, each representing a decile (0-9,10-19,etc.). How do I structure my NHibernate relationship...

FluentNhibernate mapping one-to-one

Hi, I have inhertited an legacy application, that I have little control over. I need to map a one to one relationship because "A user may have one of these, lets call them 'a Rejection', but not more than one" The data stored in the Rejection table is quite large. Anyway, I have simplyfied this model, using cats, dogs and an owner. An ...

[asp.net] NHibernate problem - invalid database path

Hi, I have strange problem with my NHibernate configuration. I have .mdb database stored in Tony\Files\database.mdb "Tony" is the project name here's the snippet of the Web.config file: private ISession OpenSession() { Configuration c = new Configuration(); c.AddAssembly(Assembly.GetCallingAssembly()); ...

Apply native SQL where clause to Nhibernate query for entity

I have this problem. I have a module (module 1) that use Nhibernate to manage entity persistence; this module interacs with an other module (module 2). The "module 2" allows to generate dynamically native SQL where clause. Now I would use it to manage filter operation in "module 1". Which is the bast way to do it? Is possible get the...

Using Sculpture with NHibernate or Entity Framework

I recently ran across this open-source project: http://www.codeplex.com/Sculpture Sculpture is a code-generator which allows you to design your domain model and then use persistence 'molds' such as NHibernate/EF and probably more to generate repositories. It takes care of all the mapping and Data access generation. It looks like it does...