Search the web
Sign In
New User? Sign Up
altdotnet · Alt Dot.Net Discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Noob Q: DDD project structure   Message List  
Reply | Forward Message #22426 of 23235 |
Re: Noob Q: DDD project structure

Hi,
it seems that you're about to use the persistance ignorance patterns often used
in DDD but without a DDD approach yet.
This is not really a problem since this patterns are generally good for the code
structure anyway.

To access the repository, you should prefere injection, it makes you code
independant of the IOC container.

Just take the repository in the controller's contructor, the container will pass
the instance when constructing the controller.
The you just have to use Add(user) (or Save(user)) on the repository.

Normally your business (domain) layer should define repositories interfaces, but
have no reference on DataAccess layer.
You implement the repositories in an other assembly that have a reference on the
business layer, and the application pass the implemented instances to the
business layer.

This way, you achieve persistance ignorance in you business layer.




--- In altdotnet@yahoogroups.com, "chevronboyde" <samuel@...> wrote:
>
> Hi All
>
> DDD Noob here needing some clarity on DDD. I am looking at an asp.net mvc web
application and have a few questions.
>
> 1) Where would actions like AuthenticateUser(username, password) exist?
> Does this exist as a method of the User entity i.e.
User.Authenticate(username, password)
> Should it exist as a service to the Domain:
UserService.AuthenticateUser(username, password)
>
> 2) When persisting entities, should I be using a service/facade or using the
Repository directly:
>
> In my UserController class:
> User user = new User("Joe Soap");
> IoC.Container.Resolve<IUserRepository>().SaveUser(user);
>
> or something like
> UserFacade.SaveUser(user) which in turn uses the repository.
>
> Previously my tiers were as follows:
> Web - asp.net
> BusinessLogic - facade and business objects with methods like User.SaveUser()
> DataAccess - encapsulated data access using ent library
> Common - config info, logging, services etc
>
>
> I am trying to understand how this translates with DDD with a simple example
of authenticating a user and also saving a user to the db. Curently using
nhibernate, castle windsor and rhino
>
> Hope that was clear
>
> Sam
>





Wed Jul 15, 2009 9:12 am

jeremie.chas...
Offline Offline
Send Email Send Email

Forward
Message #22426 of 23235 |
Expand Messages Author Sort by Date

Hi All DDD Noob here needing some clarity on DDD. I am looking at an asp.net mvc web application and have a few questions. 1) Where would actions like...
chevronboyde
Offline Send Email
Jul 13, 2009
3:19 pm

Hi, it seems that you're about to use the persistance ignorance patterns often used in DDD but without a DDD approach yet. This is not really a problem since...
jeremie.chassaing
jeremie.chas...
Offline Send Email
Jul 15, 2009
9:12 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help