Skip to main content

Questions tagged [nhibernate]

Filter by
Sorted by
Tagged with
27 votes
4 answers
40k views

What are the most common mistakes and anti-patterns NHibernate user programmers make?

What are the most common mistakes and anti-patterns NHibernate user programmers make? Please explain why those are bad practices or give link to resource for further reading. For example: One anti-...
Darius Kucinskas's user avatar
20 votes
7 answers
5k views

Is writing your own Data Access / Data Mapping Layer a "good" idea?

We're currently in a situation where we have a choice between using an out-of-the-box object-relational mapper or rolling our own We have a legacy application (ASP.NET + SQL Server) where the data-...
Eoin Campbell's user avatar
15 votes
5 answers
9k views

If Repository Pattern is overkill for modern ORMs (EF, nHibernate), what is a better abstraction?

I've recently read a lot of arguments against using the repository pattern with powerful ORM's like Entity Framework as it incorporates repository-like functionality, along with Unit of Work ...
AnotherDeveloper's user avatar
13 votes
2 answers
5k views

Why is the Repository pattern needed in NHibernate?

I am reading the official Your first NHibernate based application. While the tutorial is good and easy to follow, I am wondering why the Repository pattern is used. In the various Add, Update, ...
Zabba's user avatar
  • 311
11 votes
3 answers
8k views

DDD with ORM where should the business logic go?

I have used an MDA (model driven architecture) tool in the past where we modeled via UML and this generated the business entities (our domain model) and the ORM (mapping etc) amongst other things. A ...
JD01's user avatar
  • 1,289
8 votes
3 answers
7k views

What is the "best" way to approach validation from the perspective of a DDD purist?

I recently asked this question. I am trying to decide where to put the validation in a DDD app. I believe it should be done at every layer. I am now concentrating on the Domain model. I was ...
w0051977's user avatar
  • 7,129
8 votes
2 answers
1k views

EF vs. NHibernate [closed]

In the past 2 years since I started writing business applications (before I did either high level front end or very low level systems programming), learned datasets, linq to sql, and now entity ...
Aaron Anodide's user avatar
7 votes
1 answer
6k views

Why should I use Iesi.Collections instead of the traditional System.Collection?

Was research on how (for convetion) define a Many Many where table where both fields are primary key and found this post. So decide to install the Iesi.Collections in my library domain. But there ...
ridermansb's user avatar
5 votes
1 answer
236 views

Should I Use an ORM only when dealing with Data Model objects?

I am new to ORM, and we started developing a new system using NHibernate as the ORM. I think this question may refer to any ORM and any language/platform. The Team Leader has said we should use ...
Mithir's user avatar
  • 1,339
4 votes
1 answer
398 views

What specific features of NHibernate cause it to be recommended for legacy database systems?

So, I've been evaluating Entity Framework and NHibernate (I'm not looking for an EF vs. NH battle here, though!). One thing that I see come up very often is that NHibernate is recommended for "legacy"...
JMarsch's user avatar
  • 351
3 votes
2 answers
489 views

Is Microsoft's Entity Framework a proprietary variant of NHibernate?

I have no knowledge of Entity Framework and NHibernate but definitely want to learn. I want to know how to start. Whether to first read documentation of NHibernate or the default Visual Studio Entity ...
RPK's user avatar
  • 4,378
3 votes
2 answers
7k views

What are the best practices to use NHibernate sessions in asp.net (mvc/web api)?

I have the following setup in my project: public class WebApiApplication : System.Web.HttpApplication { public static ISessionFactory SessionFactory { get; private set; } public ...
mrt181's user avatar
  • 133
3 votes
2 answers
1k views

Should I use nhibernate for a one row settings table

I am using nhibernate in a quite big project. The system has a settings table which has 10 columns and one row, there is always a row and it should not be deleted only modified. Concurrency can be a ...
Jakob's user avatar
  • 213
3 votes
3 answers
257 views

Abstracton layer to control services access to denormalized db entity

Our db is optimized for minimum join count (partially denormalized). E.g. our User entity contains account data (nickname, facebook id, etc), user numerical statistics (total games played, total wins, ...
Vlad's user avatar
  • 311
3 votes
1 answer
1k views

Abstraction Layer over ORM Generated Entities

I am learning LINQ to SQL (and planning to learn Entity Framework). Initially I used a abstraction layer to convert LINQ to SQL entities into a domain objects. Later I discovered the “Inheritance ...
LCJ's user avatar
  • 987
3 votes
0 answers
726 views

How to implement DDD in a distributed application with NHibernate?

I have an ASP.NET MVC web site working in this way: (In the controller) var user = _applicationService.GetUserById(1); user.ChangeEmail("[email protected]"); user.ChangeAddress("my new street", ...
Apocatastasis's user avatar
3 votes
2 answers
2k views

NHibernate and complex domain model against a legacy database

I'm trying to refactor (actually, rewrite) an application which currently uses only stored procedures to access the database (hundreds of SPs). My goal is to use Nhibernate and follow a good design as ...
Dawmz's user avatar
  • 29
2 votes
3 answers
487 views

Should the domain layer be dependent on NHibernate?

Please see the code below: public interface IUnitOfWorkWrite <TSession> : IDisposable { TSession Session { get; } void Commit(); void Rollback(); ...
w0051977's user avatar
  • 7,129
2 votes
3 answers
548 views

Offline data that will need imported later

My existing application is a .NET 3.0 winform app that talks to a WCF service which in turn updates a MS SQL Server database; I can make changes at all spots (Windows client, WCF, server). I've had an ...
UnhandledExcepSean's user avatar
2 votes
1 answer
2k views

What is the benefit of using sharp architecture?

I'm working in a project that use nhibernate as orm. Is there any benefit for me to use sharp architecture? what is these benefits?
masoud ramezani's user avatar
2 votes
1 answer
115 views

How to make associations security proof

When designing an application I usually stumble upon a problem I've never quite managed to handle properly. Suppose you have Products and Orders. Usually in my data-access layer I have repositories ...
user avatar
2 votes
1 answer
2k views

A multi tenant data architecture

We are at a planning & redesign stage of our loyalty card application. As it is understood it will be a multi-tenant application. And I need to take your thoughts. Here are the some key points we ...
user avatar
2 votes
1 answer
213 views

Testing controller logic that uses ISession directly

I have just read this blog post from Jimmy Bogard and was drawn to this comment. Where this falls down is when a component doesn’t support a given layering/architecture. But even with NHibernate, ...
Rippo's user avatar
  • 109
1 vote
2 answers
590 views

What is the origin/meaning of the name 'NHibernate'?

Been poking around the web because I was curious as to why they called it that but haven't found anything yet. Anyone know? (I checked the FAQ and it wasn't clear if questions on history/origins were ...
MetaGuru's user avatar
  • 2,663
1 vote
1 answer
3k views

One Session Factory for the lifetime of an application or one Session Factory per Unit of Work?

Please see the code below, which creates a Session Factory per Unit Of Work: public int Update(IdentityRoleView role) { var role2 = AutoMapper.Mapper.Map<IdentityRole>(role); ...
w0051977's user avatar
  • 7,129
1 vote
2 answers
1k views

Unit test DAO code using SQL Lite when the application database is Oracle

We have an application with Oracle backend. The DAO layer is written in C# and uses nHibernet to perform the data operations. To unit test our DAO code, we use SQL Lite which creates the database ...
dineshsbisht's user avatar
1 vote
1 answer
1k views

Is it ok to call external services or database inside the entity

I have "logic engine" which executes set of user configured steps. These steps are saved in the database as "Step" entities. The engine gets the first step and then executes steps until there are no ...
Toni Parviainen's user avatar
1 vote
0 answers
102 views

Can NHibernate's ISession be considered as implementation of unit of work pattern?

I am debating this with myself. Does NHibernate's ISession offer a proper and correct unit of work if used without a transaction? In absence of a transaction, every SQL command would be wrapped by the ...
Suhas's user avatar
  • 297
1 vote
1 answer
2k views

.NET software design and Oracle ODP.NET UDT

I'm working on a new common .NET software design (mainly) for WCF-based web service applications with related client frontends (all written in C#). As far I've chosen some frameworks (NUnit,Autofac/...
Marco Mayer's user avatar
0 votes
2 answers
603 views

In OnionArchitecture can UI talks directly to datastore or not?

I'm fan of onion architecture but looking for some relaxing solutions in some areas. First of all I was thinking about communicating directly from UI (from controller in mvc) to data on the read side....
dariol's user avatar
  • 103
0 votes
2 answers
369 views

Definition of the NHibernate Mapping by Code / EF Code First pattern?

Sub-questions: Does this pattern have a formal definition? Who invented it? Is it considered a DSL? The reason why I am asking is because I would like to better assess its applicability to non-...
Den's user avatar
  • 4,867