I am trying to use Fluent NHibernate and the repository pattern. I would like my business layer to not be knowledgeable of the data persistence layer. Ideally I would pass in an initialized domain object to the insert method of the repository and all would be well.
Where I run into problems is if the object being passed in has a child ...
I once read a blog post and cannot find it anymore. drat!
It was about a guy who setup a wcf service (I guess RIA, but could have been something else) exposing the model via IQueryable to the querystring.
Sou you could say
http://host/articles/123/ratings
and you'd get a list (soap or json) of serialized Rating entities (the properti...
I'm trying to figure out if there's a way I can do the following strictly using Criteria and DetachedCriteria via a subquery or some other way that is more optimal. NameGuidDto is nothing more than a lightweight object that has string and Guid properties.
public IList<NameGuidDto> GetByManager(Employee manager)
{
// First, grab all ...
I'm asking both Hibernate and NHibernate groups because I'm thinking this may be a common issue seen on both.
What does it usually mean when you call a saveOrUpdate on a child object and...
1) If it is an insert everything works fine.
2) If it is an update its wiping out the parent ID in the database.
More info: problem is really occur...
Is it possible to use the criteria api to load a set of parent objects along with a filtered, eagerly loaded set of child objects? I'm trying to query a list of categories and at the same time load the categories products that start with the letter M. The query below gives me the results I want but the Products are not eagerly loaded, ...
I am getting the following nhibernate error when saving an entity (via: NHibernateSession.Save(entity);) despite it being persisted to the database fine
"Value cannot be null.Parameter name: id"
This is my hbm file
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="mydatabase.Doma...
Does anyone have any tips or best practices regarding how Autofac can help manage the NHibernate ISession Instance (in the case of an ASP.NET MVC application)?
...
Hi every one.
let's say that i have an order system.
each "Order" references a "Customer" Object.
when i fill the orders list in Data Access Layer, the customer object should be brought from
a Customer Web Service "WCF".
so i didn't map the Customer property in the Order mapping class,
Id(o => o.OrderID).GeneratedBy.Identity();
...
Hello, and first off thanks for your time to look at this.
For a research project I'm working on, I have a somewhat complex design (which I've been given) to persist to a database via NHibernate.
Here's an example of the class hierarchy:
TransitStrategy, TransportationCompany and TransportationLocation are all abstract classes.
The...
I'm well aware that similair topics have been brought up before
e.g. http://stackoverflow.com/questions/1639043/entity-framework-4-vs-nhibernate
But instead of arguments like:
NHibernate have been around longer and is more mature
EF4 is drag n drop and not enterprisy
EF4 and LinqToSql are ...
I would like to see a more detailed lis...
I am building a website on top of nhibernate. Is there any efficient way to build reports? BY reports, I mean is there anyway to execute a complicated query that grabs random pieces of data? StoreProcedures? Hql?
Can I get single, non mapped values from hql?
...
Hi,
I’m facing an issue with NHibernate performance and can you please suggest me some optimizations? Below mentioned is a small summary of my application architecture
I have a windows service which is listening to a messaging bus. On receiving a message the service creates an object out of which a property is the received xml snippet ...
Say I have two entities Foo and Bar where Foo has-many Bar's,
class Foo {
int ImportantNumber { get; set; }
IEnumerable<Bar> Bars { get; set; }
}
class FooDTO {
Foo Foo { get; set; }
int BarCount { get; set; }
}
How can I efficiently sum up the number of Bars per Foo in a DTO using a single query, preferrably only with the Cr...
Hi,
i've being banging my head against the desk all day with the following Nhibernate problem.
Each bank account has one (and only one) set of rates associated with it. The primary key of the bank account table, BankAccountID is also a foreign key and the primary key in the AccountRate table.
public class BankAccount
{
public virtu...
I'm asking this from a c#/NHibnernate perspective, but it's generally applicable. The concern is that the HiLo strategy goes though id's pretty quickly, and for example a low record-count table (Such as Users) is sharing from the same set of id's as a high record-count table (Such as comments). So you can potentially get to high number...
Below is my implementation of the state pattern. In order to persist the State object to my database with NHibernate, I am assigning each state class an enum value. This is stored as a private field on the entity, and mapped to a integer field in my database table.
I want to know whether this is a good implementation as I will be using ...
Hi,
I am trying to configure NHibernate on my console application in which I am trying to map an Employee class to a table Employee.
I am getting below exception which I have no clue:
Class:
class Employee
{
public int id;
public string name;
public Employee manager;
public string SayHello()
...
What is the simplest most effective way to verify that your SQLite db is actually out there after using NHib's schema generation tool?
Cheers,
Berryl
EDIT
I am hoping there is something tied to the ISession (like the connection property) that can be tested; sometimes when running a series of tests it seems like a good session (IsOpen ...
What is the correct way to UPDATE a child object with NHibernate but not have to "awake" the parent object. Lets say you would like to try to avoid this because the parent object is large or expensive to initiate.
Lets assume classes are called Author(parent) and Book(child). (still, trying to avoid instantiating Author)
Book comes bac...
How to do either a HQL or a Criteria search (the latter is preferred) involving an enum that is used as flags. In other words, I have a persisted enum property that stores some kind of flags. I want to query all the records that have one of these flags set. Using Eq won't work of course because that will only be true, if that is the only...