The Tables
Currencies
----------
CurrencyId INT IDENTITY PK
IsoCode4217 CHAR(3) -- "USD", "GBP", "EUR", etc
Users
----------
UserId INT IDENTITY PK
CurrencyId FK REFERENCES Currencies (CurrencyId)
The Mapping
The current application has a Currency object that needs the IsoCode4217 value. A Currency is not an entity in this applicat...
How compatible is ORM and existing databases that have a lot of constraints (particularly unique key constraints/unique indexes beyond primary keys) enforced within the database itself?
(Often these are preexisting databases, shared by numerous legacy applications. But good database modeling practice is to define as many constraints as ...
Using NHibernate, is it possible to fill an existing object using the results of a query, rather than returning a new entity? For example:
var foo = new Foo();
session.GetById(foo, id);
...
I am new to Nhibernate and I am using Nhibernate 2.1.0 RC1. In C# I have the following classes:
public class Application
{
public virtual int Id { get; set; }
public virtual Applicant Applicant { get; set; }
}
public class Applicant
{
public virtual int Id { get; set; }
public virtual string FirstName { get; set; }
...
It now makes sense that the versions aren't right.
I know I am using Castle Windsor 2.0 and I would like to use NHibernate with Fluent NHibernate - what versions do I need of these two?
Edit Ok, I think I got it wired up. I'm still having a version issue.
I now get this error when using the direct download from their site. The only lib...
Hi I seem to be at an ORM Tool crossroad and would like some advice of people who have faced a similar challenge. In the past I have been using CodeSmith with NetTiers Templates to generate my DAL all has been quite good, however I have decided to drop this for one reason or another.
So I am at a crossroads and have found the following:...
If I needed to get NHibernate to support more databases (not included in the list of supported: https://www.hibernate.org/361.html), assuming that database can be accessed using it's built-in query language,but not SQL (example: http://kx.com/Products/kdb+.php)...
How will I be able to get NHibernate to work with these databases?
...
i am trying to use NHibernate.Search together with CastleProjects ActiveRecord as descriped
here http://using.castleproject.org/display/AR/Using+NHibernate.Search+with+ActiveRecord
but i am getting the following error as soon as i decorate the first buisness object with the indexed attribute
Zeile 135: sessFactory = cfg.BuildSessi...
What would be the best way to add projections to an nhibernate query that already may or may not have 1 or more projections set? Calling .SetProjection() appears to replace any projections that may already be there.
To give a little background context I am using a version of the paged result extension method found here and I have come ...
I've this configuration in the hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver...
Given the following fixed domain model:
public class Sentence {
public int Id { get; private set; }
public string Author { get; set; }
public string[] Words { get; set; }
}
And the following proposed normalized database schema:
create table Sentence (
Id int identity(1,1) not null primary key,
Author varchar(450)
...
I'm loading a lot of data into the database with NHibernate. As I'm inserting, I want to check for duplicates.
I call saveorupdate in each loop without flushing the session.
Is there a way to query this session for duplicates without flushing?
...
Let's say I got a simple view that displays a Product Name and whether it has been discontinued. I am pulling the data out of Northwind database. I am using a simple Model View Pattern and a DAO Pattern with NHibernate. When the Form loads I have my UI with a Load Button and a Save button. If I hit the Load button than in my code behind ...
I'm using FluentNHibernate but NHibernate XML will do.
Say I have this model
public User
{
public User()
{
ProfilePicture = new Picture();
}
public Guid Id { get; private set; }
public Picture ProfilePicture { get; set; }
}
public Picture
{
int width;
int height;
}
How do I tell NHibernate how to ...
I have an ASP.NET MVC app which depends on a lot of settings (name-value pairs), I am planning to store this information in a database table called SiteSettings. Is there an easy way in which I can get these settings using NHibernate. And what are the best practices when saving settings for a web application. And by settings I mean the s...
I am trying to work out with ORM tool to move over to and have narrowed it down to two candidates.
nHibernate or LLBLGen Pro
Please can you guys give me pros and cons in using both these tools especially if you have experience in both. I am not really interested in any other tools but am wanting some heads up so I can decide which too...
Hi I've got this enum:
[Flags]
public enum ShowProductOn : short
{
HomePage = 1,
SalesPage = 2,
NewsLetter = 4
};
Valid values for this enum:
1 - HomePage
2 - SalesPage
3 - HomePage, SalesPage
4 - NewsLetter
5 - HomePage, NewsLetter
6 - SalesPage, NewsLetter
7 - HomePage, SalesPage, NewsLetter
I would like to...
With .NET, which data access method is better to use "LINQ to SQL",entity framework, or NHibernate?
Should a different method be used depending on the situation or is it more of a personal preference?
If so which method and when?
...
I have Fluent NHiberate with the Castle Facility up and running.
However, how do you set the NamingStrategy? I tried with the Configuration object, with no luck. Does my naming strategy need to be registered in my Windsor container?
...
I have an object that represents a Location. Locations can contain other locations. How can I represent this relationship with Fluent NHibernate. The class looks like this:
public class Location : EntityBase
{
#region Properties
public string LocationName { get; set; }
public Location ParentLocation { get; private set; }
...