Repository

S

shapper

Hello,

I am working on an MVC Application and I am using the DDD pattern.

I placed the Entities under MyApp.Domain.Entities.

My problem is where to place the repositories?
I have IProductRepository interface and ProductRepository class in
MyApp.Domain.Repositories.

Should they be on the same namespace? The interface and the
implementation ...

Thanks,
Miguel
 
R

Registered User

Hello,

I am working on an MVC Application and I am using the DDD pattern.

I placed the Entities under MyApp.Domain.Entities.

My problem is where to place the repositories?
I have IProductRepository interface and ProductRepository class in
MyApp.Domain.Repositories.

Should they be on the same namespace? The interface and the
implementation ...

I use top level folders in my domain model projects. Interfaces go in
the Abstract folder while interface implementations go in the Concrete
folder. By default interfaces and implementations are in different
namespaces. The namespaces can be manually altered if desired.

regards
A.G.
 
S

shapper

I use top level folders in my domain model projects. Interfaces go in
the Abstract folder while interface implementations go in the Concrete
folder. By default interfaces and implementations are in different
namespaces. The namespaces can be manually altered if desired.

regards
A.G.

Where do you put your entities? In a Entities folder?
And the folders are correspondent to namespaces? Is it?

I use 4 projects, correspondent to 4 main namespaces, and then I have
"child" namespaces as follows:

- Proj.Infrastructure
(Contains common elements used in other layers.
Example: StringExtensions, IUnitWork, etc)

- Proj.Domain
(Contains Entities, Repositories interfaces and Implementations,
Factories, Services that deal with Entities, etc)

At the moment I have the following namespaces: Services,
Repositories, Entities, Factories, ...

So you say that inside Proj.Domain.Repositories I should have
Abstract and Concrete namespaces?

Or inside Proj.Domain I should have Abstract namespace witll all
Services and Repositories interfaces.
Inside Proj.Domain.Concrete I would have all Services and
Repositories implementations?
And where the Entities would go?

- Proj.Application
Here I have only a few type of Services like TwiiterService,
MailService, etc

- Proj.Presentation
Here I have the ASP.NET MVC Web Application or the NET WPF
application,

Please, anyone, any suggestion to improve my implementation is
welcome.

I am just creating a base pattern to work from but there might be some
things that I am missing.
One is: what should I place in Proj.Application. The services I
suggested? But can I separated the services from Proj.Application and
Proj.Domain?
Besides TwitterService and MailService I am not sure what other
services I could have since I already have repositories.

I am not sure where the services come in when using repositories.

Anyway, any suggestion is welcome.

Thanks,
Miguel
 
R

Registered User

Where do you put your entities? In a Entities folder?
And the folders are correspondent to namespaces? Is it?
Yes and yes.
I use 4 projects, correspondent to 4 main namespaces, and then I have
"child" namespaces as follows:

- Proj.Infrastructure
(Contains common elements used in other layers.
Example: StringExtensions, IUnitWork, etc)

- Proj.Domain
(Contains Entities, Repositories interfaces and Implementations,
Factories, Services that deal with Entities, etc)

At the moment I have the following namespaces: Services,
Repositories, Entities, Factories, ...

So you say that inside Proj.Domain.Repositories I should have
Abstract and Concrete namespaces?
I'm not saying anything ;) I'm only two weeks in with MVC myself.

I'm using the Apress book "Pro ASP.NET MVC Framework" along with
on-line materials. I find it interesting the text example uses the
Abstract and Concrete folders yet service interfaces and
implementations both go in a single Services folder. It doesn't really
answer the 'what goes where' question. Of course it is an example
exercise and not a guide to best practices. Folders and namespaces are
probably a matter of personal/project preferences.
Or inside Proj.Domain I should have Abstract namespace witll all
Services and Repositories interfaces.
Inside Proj.Domain.Concrete I would have all Services and
Repositories implementations?
And where the Entities would go?

- Proj.Application
Here I have only a few type of Services like TwiiterService,
MailService, etc

- Proj.Presentation
Here I have the ASP.NET MVC Web Application or the NET WPF
application,

Please, anyone, any suggestion to improve my implementation is
welcome.

I am just creating a base pattern to work from but there might be some
things that I am missing.
One is: what should I place in Proj.Application. The services I
suggested? But can I separated the services from Proj.Application and
Proj.Domain?
Besides TwitterService and MailService I am not sure what other
services I could have since I already have repositories.

I am not sure where the services come in when using repositories.
I see repositories as the DAL while services are used to communicate
with external entities.

My questions are more about the BL and where it fits in. I'm working
with a BL where the result of a query can be an 'exclusion'.
Discovered exclusions are used to filter subsequent queries during the
session. This requires a collection of exclusions to persist through
the session. I see several ways to do this but they all seem kludgy.

regards
A.G.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top