Questions tagged [persistence-ignorance]

22 questions
46
votes
8 answers

What exactly is "persistence ignorance"?

Persistence ignorance is typically defined as the ability to persist & retrieve standard .NET objects (or POCOs if you really insist on giving them a name). And a seemingly well accepted definition of a standard .NET object is: "...ordinary classes…
Greg Beech
  • 133,383
  • 43
  • 204
  • 250
41
votes
3 answers

What are the benefits of Persistence Ignorance?

I am a newbie in the DDD+TDD World. But I have been in programming for almost 9 years. Can someone please explain me the benefits of persistance ignornace ? Typical nHibernate application just pushes the dependency between class and database to…
cbrcoder
  • 530
  • 1
  • 4
  • 8
9
votes
3 answers

Can Persistence Ignorance Scale?

I've been having a brief look at NHibernate and Linq2Sql. I'm also intending to have a peek at Entity Framework. The question that gets raised, when I talk of these ORM's is "They can't scale", so can they? From Google I get the impression they're…
6
votes
3 answers

DDD: Persisting aggregates

Let's consider the typical Order and OrderItem example. Assuming that OrderItem is part of the Order Aggregate, it an only be added via Order. So, to add a new OrderItem to an Order, we have to load the entire Aggregate via Repository, add a new…
4
votes
2 answers

Attaching entity with association for modify

I would modify detached entity with associated collection, ex : Person and Address are POCO. When I attach entity and save changes, the collection changes isn't detected, how can I update Person with Address (added and deleted items) ? Do I to…
rad
  • 1,857
  • 1
  • 20
  • 30
4
votes
1 answer

Efficiently Determine if EF 4 POCO Already in ObjectSet

I'm trying EF 4 with POCO's on a small project for the first time. In my Repository implementation, I want to provide a method AddOrUpdate that will add a passed-in POCO to the repository if it's new, else do nothing (as the updated POCO will be…
Eric J.
  • 147,927
  • 63
  • 340
  • 553
4
votes
4 answers

Persistence ignorance and DDD reality

I'm trying to implement fully valid persistence ignorance with little effort. I have many questions though: The simplest option It's really straightforward - is it okay to have Entities annotated with Spring Data annotations just like in SOA (but…
kboom
  • 2,279
  • 3
  • 28
  • 43
3
votes
1 answer

How does persistence ignorance work with references to (non-root) aggregates?

We have several aggregate roots that have two primary means of identification: an integer "key", which is used as a primary key in the database (and is used as a foreign key by referencing aggregates), and internally within the application, and is…
3
votes
3 answers

Exposing IUnitOfWork interface in Domain Layer violates Persistence Ignorance rule?

1) In most cases each Aggregate Root should define its own transactional boundary, in which case we don't need to expose IUnitOfWork interface in Domain Layer. a) I assume in this situation a good option would be for a repository ( used by…
bckpwrld
  • 1,159
  • 1
  • 11
  • 23
3
votes
2 answers

NHibernate ITransaction and pure domain model

I'm trying to write my Domain Model as persistence-ignorant as possible. The only thing I'm doing right now is marking every property and method virtual, as NHibernate requires that for lazy-loading. In my domain model assembly I define some…
Bruno Reis
  • 37,201
  • 11
  • 119
  • 156
2
votes
2 answers

Persistance Ignorance Linq to SQL

I have an existing domain layer. I want to develop the persistence layer using Linq to SQL. I am currently using an external map file. I am trying to use lazy loading for my child collections but am unsuccessful. Is there a way to implement lazy…
Hemanshu Bhojak
  • 16,972
  • 16
  • 49
  • 64
2
votes
2 answers

Entity Framework - Schema Upgrade, Multiple DBMS, and Code First

I'm looking into using Microsoft's Entity Framework in an upcoming project which is a point release of an existing product. Our current product supports two DBMS (Oracle and SQL Server), the schema of each is maintained in separate .sql script…
Travis
  • 2,654
  • 4
  • 26
  • 46
2
votes
1 answer

EF - Persistence Ignorance for Detach object - Best Practice

Nowdays I cannot understand at all how the persistence ignorance could be applied with entity framework. I've a classic repository and unit of work design by using entity framework. Now, imagine a simple client side scenario where I need to read…
bit
  • 934
  • 1
  • 11
  • 32
1
vote
1 answer

Custom Data Access in EF for POCO

I am currently writing a WCF data service that is meant to extract data from any database in a predefined standard structure. I was thinking of using POCO entities. I can design my entities on EF designer and generate the POCO classes from it but…
1
vote
2 answers

How to unit test with persistence ignorance

I'm working on a new project where I'm actively trying to honor persistence ignorance. As an example, in my service layer I retrieve an entity from my ORM and I call a routine defined on the entity that may or may not make changes to the entity. …
Mayo
  • 10,544
  • 6
  • 45
  • 90
1
2