I have a problem trying the following with nHibernate:
Eager loading.
Use selects (here is my problem, I can only do this using joins)
Filtering children.
Let's use an example where we have the RichPerson class that can have multiple: cars, houses, motorbikes and companies. All mapped to different entities with different tables.
If...
I am struggling to figure out how I should override equals and get hashcode for a class I am writing using NHibernate.
Basic business scenario is that users cannot re-use the same password within a 90 day limit.
So I have a "user" that has many "historical passwords"... the user class was easy as I just use the login in the equals. B...
I am using NHibernate with a SQL query to populate some entity objects.
I have an Item object which references a User object (to indicate the owner of the Item)
class Item
{
public User User;
}
My SQL query is (it's actually more complicated, which is why I can't use HQL, but I started with this to make sure the AddJoin/AddEntity was...
I am now ready to use NHibernate to persist my data layer access. I used DDD until that point and I use fake for unit tests and for the test site.
I know that I can use SchemaExport for unit/integration tests of my NHibernate concrete repositories but how should I generate the schema to be used for the test site ?
Should I create a spe...
Assume the following mapping entries:
< class name="Customer" table="customer">
<id name="InternalId" column="uintCustomerId" type="long">
<generator class="identity" />
</id>
<!-- The BinaryBlob below is a 16 byte array - Think Guid.NewGuid().ToByteArray -->
<property name="CustomerUid" column="uidCustomerId" type="BinaryBlob" not-...
I have an interesting issue, which I can't seem to find a satisfying answer for. It concerns join tables.
Basically (I'm sure this has been out here in some form or another, but I cant find it) I have 3 tables. A Person table, Address table, PersonAddress..
Person
PersonID
Name
Age
etc..
Address
AddressID
AddressLine1
AddressLine...
I am looking for a well rounded ORM that handle concurrency with ease for .NET. It should also be threadsafe.
Any recommendation? Pls elaborate why you choose this particular ORM.
...
I have the following class structure:
class TestCase {
public IList<Step> Steps { get; set; }
}
class Step {
public IList<Action> Actions { get; set; }
}
class Action { }
I want to load a TestCase, all Steps, and all Events in one query and avoid the Select N+1 problem.
This post solves the problem of loading the Steps with Te...
I have an Address class that I want to use for other objects address info. Below I paste 2 example classes Company and Person that use Address class
public class Company
{
public virtual string Name { get; set; }
public virtual string Phone { get; set; }
public virtual string Fax { get; set; }
public virtual Address Add...
I have a question about how to keep the current ASP.net/User's session during the duration of a user's visit. What is the best way to keep the current User object?
Currently I am keeping it as a session object in the Session management in ASP.net. I do have Context.User.Identify.User keeping the email address/PK, but is there a better ...
Hi, I've got following mappings:
<bag name="BList" table="A_TABLE" inverse="true" lazy="false" cascade="all-delete-orphan">
<key column="A_ID"/>
<one-to-many
class="B, Model" />
</bag>
And
<many-to-one name="A"
class="A, Model"
column="A_ID"
not-null="true" />
Performing insert and up...
Can I somehow get the object that caused a GenericADOException (constraint exception)?
Or How can I only flush one object so I can tell which one is the problem.
I have a list of object that are displayed in a form, and can be edited and added to. On flush it gives me a database exception but I can't tell which object gave the exceptio...
I'm trying to generate NHibernate mappings with ActiveRecord. I can create classes from a diagram by targeting ActiveRecord, but whenever I target NHibernate, I get the following error:
Error 1 Running transformation: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO...
I have a service layer returning a collection of entities :
/// <summary>
/// Returns list of all existing accounts.
/// </summary>
IList<Account> GetAllAccounts();
This is called on UI layer to get IList collection and bind it to UI via IBindingList :
public BindingList<Account> Accounts
{
get;
private set;
}
public voi...
Hi!
I have a (several actually) relationship between two objects, the parent object is a User and the child object is an Incident.
There are four relationships defined between User and Incident:
Property User_created of Incident refers to a User who created the Incident
Property User_modified who modified the Incident
User_reported and...
I am getting this error when I am trying to get the CurrentSession
NHibernate.Context.CurrentSessionContext.CurrentSession()
at NHibernate.Impl.SessionFactoryImpl.GetCurrentSession()
...
This is a bug?
Using NHibernate.Expression.Example.Create(userExample) if my class use Int32 on property 'Type' all works fine.
public class User:Person
{
public virtual String NickName { get; set; }
public virtual String Password { get; set; }
public virtual Int32 Type { get; set; }
public enum UserType
{
...
How do I configure NHibernate to create the db schema with a column like this:
create_dt datetime not null default getdate()
I have this in the mapping file:
<property name="create_dt" update="false" insert="false" generated="insert" not-null="true" />
Is there anyway I can inject the sql server specific default getdate(). The docu...
As a newbie to nHibernate, I am finding the creation of sessions to be a tad confusing.
Why doesn't nHibernate ship with something like what (i believe) Unit Of Work does?
or is there something built and UofW is more of an addon/preference? (context: ASP.NET MVC web application with SQL server).
Note: I am new to nHibernate, and spoi...
I've recently inherited a system that relies heavily on an EAV database structure, and is really struggling from a performance perspective.
What I want to do is use nhibernate or another suitable ORM product to map these EAV tables to entities in such a way that we can map a row to a property. We can then refactor the database in order ...