I am using NHibernate on a new ASP.NET project, and am running into what I believe to be strange behavior. I am attempting to manage my session by using an HttpModule to catch the EndRequest event and close the session. This is working fine, however, after the EndRequest event fires, I am getting an exception in the OnLoad event of one...
This question is about "best use" scenarios in projects with ORMs like NHibernate, Subsonic, Linq2SQL, etc...
All of these tools generate basic entity classes, some with attributes, others without. Do people use these classes as their business classes? Or is there wholesale copying of data from ORM generated classes to manually create...
This is in reference to a question I asked earlier. Aside from viewing the SQL generated by NHibernate on calls to the database, what is the best way to find bottlenecks between NHibernate and the DB? In particular, I have queries that return very quickly when run directly against the database, but very slow (over 3-4x) return times when...
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 ...
I have a 3-leveled hierarchy of entities: Customer-Order-Line, which I would like to retrieve in entirety for a given customer, using ISession.Get(id). I have the following XML fragments:
customer.hbm.xml:
<bag name="Orders" cascade="all-delete-orphan" inverse="false" fetch="join">
<key column="CustomerID" />
<one-to-many class="O...
I'm doing this system Stacked and I am creating the search function. And in that process it occurs to me that maybe AR/nHibernate Expression.Like (and siblings) might maybe not be 100% "safe" in that you can create stuff like;
"\r\ndrop database xxx;---" and similar things...?
I would expect them to be safe, but I am not sure...
...
Update:
Turns out we were looking in the wrong place for a solution. Initially we were using only Configuration.ClassMappings and Configuration.CollectionMappings and as my original comments indicated, columns weren't being exposed from the CollectionMappings.
We found success (and the enumerations we wanted) when we worked through eac...
Hi,
I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time. I've contacted support but they said that it's my app not their...
I am currently using an enumeration in an NHibernate mapped as follows..
public enum UploadMethod
{
Java, Silverlight, Gears, Flash
}
class UploadMethodType : EnumStringType
{
public UploadMethodType() : base(typeof(UploadMethod), 255) { }
}
public class Person
{
/* Bunch of non interesting properties... */
public Uplo...
I have a many-to-one relationship where the child table can have hundreds of thousands of records. In this case, calling Parent.ChildCollection.Count forces a lazy initialization of the child collection which is extremely expensive.
In Hibernate 3.0 there is a feature lazy="extra" which allows you to check a subset of collection proper...
in simple words, any one?
...
I have at my SQL Server 2000 Database a column with type Image. How can I map it into NHibernate?
...
Consider the following table structure...
Appointment
ID integer
Description nvarchar
StatusID smallint
Status
ID smallint
DisplayText nvarchar
Now, for good or for evil, we want this situation to map to a class that looks like this
class Appointment
{
public int ID {g;s;}
public string Description { g;s; }
public strin...
I am wondering how to tell NHibernate to resolve dependencies on my POCO domain objects.
I figured out that methods like CalculateOrderTax should be in the Domain object because they encode domain specific business rules. But once I have two of those I am violating SRP.
It would be no problem to extract those methods to Strategy class...
Hi. I'm a newbie in the great world of NHibernate. I'm using version 2.0.1.GA. Here's my question. I have a table Cars with column Manufacturer(nvarchar(50)) and a primary key ID(int). My .NET class is:
public class Car
{
public virtual int ID { get; set; }
public virtual string Manufacturer { get; set; }
}
Now if I want to re...
I’m having some troubles with stored procedures (sp) and nhibernate. I want to map from the returned values of a sp a part to a domain object (already mapped through hbm.xml) and another part to a flag variable. Which is the best way of doing this? without casting objects? As a solution i was trying adding a property value in the domain ...
Is there a specific reason that the EF requires new data providers and can't make use of ODBC? I figured it had to be some ORM specific problem, but NHibernate works fine via ODBC.
I'm using NHibernate and can continue to use Nhibernate, but I worry that I can't assume Nhibernate knowledge for any future programmers here.
...
I'm building a blog using C# and nHibernate for my database persistence. I want to make the entries taggable so I have an IList for the tags property. But how do I map this to a comma separated list in a single column in my database?
I want to avoid using a separate table for the tags and just keep them in one column as a separated lis...
We are using NHibernate to manage our persistence in a complex modular windows forms application - but one thought keeps bothering me. We currently open a session on launch and open all objects through that session. I am worried that all loaded objects get loaded into the NHibernate session cache, so that they cant be garbage collected, ...
I don't know how to save object with where clause. I need it to prevent saving object with range of dates overlapping on others.
public class TaskEvent
{
public DateTime StartDate {get;set;}
public DateTime EndDate {get;set;}
}
I want to check overlaping in criteria within saving operation but I don't know how.
Any ideas?
...