Repository Pattern with Entity Framework 4.1 and Parent/Child Relationships

The primary reason why I want to use this pattern is to avoid calling EF 4.1 specific data access operations from the domain. I’d rather call generic CRUD operations from a IRepository interface. This will make testing easier No it will not make your testing easier. You exposed IQueryable so your repository is not unit … Read more

Are persistence annotations in domain objects a bad practice?

In my latest iteration on an existing system using Spring and Hibernate, I have started to move in a similar matter. When first implementing Hibernate models, I strove to separate the application logic in service classes from the persistence logic via data access objects. When building a new system last year I allowed most of … Read more

Onion Architecture – Repository Vs Service?

The repository is not a gateway to access Database. It is an abstraction that allow you to store and load domain objects from some form of persistence store. (Database, Cache or even plain Collection). It take or return the domain objects instead of its internal field, hence it is an object oriented interface. It is … Read more

Communicating between two Bounded Contexts in DDD

When integrating BCs, you have a few options. The reason that calling out to an external BC is discouraged is because it requires for both BCs to be operational at the same time. However, this is often quite acceptable and is simpler than the alternative. An alternative is to have the Game BC subscribe to … Read more

Specification Pattern in Domain Driven Design

I think Specification pattern is not designed for query criteria. Actually, the whole concept of DDD is not, either. Consider CQRS if there are plethora of query requirements. Specification pattern helps develop ubiquitous language, I think it’s like kind of a DSL. It declares what to do rather than how to do it. For example, … Read more

Best way to implement Repository Pattern?

There’s also a good argument for a “none of the above” approach. The problem with generic repositories is that you’re making the assumption that all objects in your system will support all four CRUD operations: Create, Read, Update, Delete. But in complex systems, you’ll likely have objects that support only a few of the operations. … Read more

Why always have single implementation interfaces in service and dao layers?

There are more advantages to interfaces – As in proxying . If your class implements an interface , JDK dynamic proxies will be used by default for AOP . If you use the implementations directly, you’ll be forced to use CGLIB proxies by making proxy-target-class=true . These require byte code manipulation unlike JDK proxies . … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)