UPDATE: This is now resolved, see answer below.
I am having a bit of trouble trying to work out the correct way to write an NHibernate Mapping File (.hbm.xml) for a MSSQL Stored Procedure.
The Stored Procedure accepts two parameters and returns a single row result set containing several columns which have integer values.
My mappin...
I would like to get opinion on the best way to manage the following please. I have an MVC application project, as well as a DomainModel project. The NHibernate mappings and hibernate.cfg.xml are in the DomainModel project which is referenced in the MVC application. This would normally work fine as all my dataaccess would go through the N...
I have a users table that is updated by other systems. I have mapped the table to my users objects and that work great. As user data is owned by another system I don't want to change the structure of that table.
I want to add metadata to the user objects, but without changing the structure of the users table. I want to add a flag that t...
I have an Animal class that implements IDomainObject. There is another class, Cat, that inherits from Animal. I'm using a Table Per Subclass inheritance strategy for my NHibernate mappings and map the CreatedDate and LastModified properties to columns in the Animal table and to columns in the Cat table.
I also use a PreUpdate event hand...
Good evening everyone,
I've got a project using nHibernate (2.1.2.4000) and System.Data.SQLite (1.0.66.0). I want to enforce NHibernate to create foreign keys when it creates the database or at least use the "foreign key" keyword then I'll be able to create the triggers.
I googled but I didn't find any documentation on how to do that a...
Where should I put my NHibernate SchemaExport method and how should I call it when I decide to recreate the database?
Should I leave this in my startup project (an asp.net mvc project)? Should I create a seperate console project just for exporting my schema?
I think these questions all originate from the fact that I don't want schema...
In my web application a Session is created in the BeginRequest handler. All database operations are performed against this session. In the EndRequest handler, the session is used to create a transaction which is then committed. Afterward, the session is disposed. This wraps all database operations performed against the session into a...
I am new to fluent nhibernate. I have the following combination of table per subclass and single table with discriminator per subclass structure. Will appreciate any help in mapping this with fluent - specially with automapping:
enum type {a, b, c, d}
Class pool
{
int id;
IList<Class1> aVals;
IList<Class1> bVals;
IList<Class2> cVals;...
We are using nHibernate in our domain model, and would like to create DTOs for sending objects over WCF to a front-end application made using the MVVM-pattern (WPF/WinForms). We have total control of both the client and server - and both are upgraded at the same time, so versioning/cross platform is not an issue.
I see how editing singl...
Hi,
I have quite a complex entity structure where several classes inherit from a base class, hence choosing a table per-subclass structure in nhibernate.
BaseProject
ProjectA : BaseProject
ProjectB : BaseProject
ProjectC : BaseProject
ProjectD : BaseProject
I want to search where one of the criteria will be ProjectType. I'm trying to...
I have the following class which I am mapping using Fluent NHibernate's AutoMapper. I do not want the list items publically modifiable so have a public IEnumerable backed by an IList which can be populated internally or by NHibernate.
I want NHibernate to map teamMembers to a column named TeamMembers. I also want FNH to ignore the TeamM...
Hi,
I know the question of session management has been brought up in the past, but I could not find anything that helps me overcome my problem..
I have a number of repository classes (e.g CustomerRepository, ProductRepository etc.) which I resolve through Castle Windsor (Note: I am trying to apply the three calls pattern as outlined he...
I have the following tables and i have no control on the table schema
DocumentText
{
NoteId
OutputType
Note_Text
}
OrderCoordinator
{
AuthoriserCode
Value
}
DocumentText joined to OrderCoordinator on (Note_Text = AuthoriserCode)
only when Outputtype='PRTYPE'
How do i map this using fluent nhibernate
i am currently mapping ...
Hi
I have googled but haven't been able to find any information about future support for Nhibernates SchemaUpdate against SQLite?
And does anybody have any other solutions to recommend?
Thanks in advance
...
I'm using Ayende's method (http://ayende.com/Blog/archive/2009/04/29/nhibernate-ipreupdateeventlistener-amp-ipreinserteventlistener.aspx) to set the create and update date on entities with Listeners, but it's only setting them for the entity being affected, not anything else in the unit of work.
So, for example, if I do this:
Order ord...
Hi guys,
I have got an abstract base class and inherited poco entities. I am using table per subclass inheritance with fluent nhibernate 1.1 automapping.
The class inheritance looks like follows
Node (abstract class)
Place : Node
Asset : Node
Node class is basically a tree structure.
public abstract class Node
{
publi...
While I have already solved this issue in a previous question using a native query. I am now wondering if it is possible to create a custom expression that is usable in a Criteria without using the where clause? The reason I don't want the where clause is because Oracle's connect by ... start with ... (here) statement. I followed this pa...
Supposing the following entities :
public class AppUser
{
public virtual int Id { get; set; }
public virtual string Login { get; set; }
}
// Mapped as joined-subclass
public class Person : AppUser
{
public virtual int Age { get; set; }
}
If I create 1 AppUser, and save it like this
var user = new AppUser() { Login = "t...
Is there a way in NHibernate to check if an object exists in the database without having to get/load the object?
...
I have a class
public class Item : IItem
{
public virtual Guid Id { get; set; }
public virtual string Name { get; set; }
public virtual bool IsActive { get; set; }
}
public interface IItem
{
Guid Id { get; set; }
string Name { get; set; }
bool IsActive { get; set; }
}
public class ItemMap : ClassMap<Item>
{
...