onion-architecture

Onion archicecture dependencies in the same layer: Infrastructure and Web communicating

不羁的心 提交于 2019-12-03 00:18:39
问题 I am designing an ASP.NET MVC application using the Onion Architecture described by Jeffrey Palermo. It is an ASP.NET MVC 2.0 project, where I am requiring that all views be strongly typed using dedicated View Models -- we will not be passing domain models to our views. We are using AutoMapper to do the translation -- AutoMapper is isolated in the infrastructure, Web does not know or care that AutoMapper is being used. Currently, I am defining the IViewModelMapping interfaces in the Web

Onion Architecture - Repository Vs Service?

我怕爱的太早我们不能终老 提交于 2019-12-02 16:45:36
I am learning the well-known Onion Architecture from Jeffrey Palermo. Not specific to this pattern, but I cannot see clearly the separation between repositories and domain services. I (mis)understand that repository concerns data access and service are more about business layer (reference one or more repositories). In many examples, a repository seems to have some kind of business logic behind like GetAllProductsByCategoryId or GetAllXXXBySomeCriteriaYYY . For lists, it seems that service is just a wrapper on repository without any logic. For hierarchies (parent/children/children), it is

Onion archicecture dependencies in the same layer: Infrastructure and Web communicating

只谈情不闲聊 提交于 2019-12-02 13:59:43
I am designing an ASP.NET MVC application using the Onion Architecture described by Jeffrey Palermo. It is an ASP.NET MVC 2.0 project, where I am requiring that all views be strongly typed using dedicated View Models -- we will not be passing domain models to our views. We are using AutoMapper to do the translation -- AutoMapper is isolated in the infrastructure, Web does not know or care that AutoMapper is being used. Currently, I am defining the IViewModelMapping interfaces in the Web project -- simply because this service will be used by the Controllers and it has direct access to its own

Does a Generic Repository need a Base Entity class to be applied everywhere?

為{幸葍}努か 提交于 2019-12-01 13:03:31
I am creating an Intranet website with ASP.NET MVC and Onion Architecture . I have been implementing the repository pattern but I have a difficulty. Let's say I have a Document table with IDDocument in it. Then this is my repo(with just one method): class Repository<T> : IRepository<T> where T : class { private readonly PrincipalServerContext context; private DbSet<T> entities; //Constructor and stuff here public T Get(long id) { return entities.SingleOrDefault(s => s.IDDocument == id);//Here is my problem } } The problem is that I cannot use this since T is not recognized as being from

Onion Architecture, Unit of Work and a generic Repository pattern

六月ゝ 毕业季﹏ 提交于 2019-11-28 17:17:43
This is the first time I am implementing a more domain-driven design approach. I have decided to try the Onion Architecture as it focuses on the domain rather than on infrastructure/platforms/etc. In order to abstract away from Entity Framework, I have created a generic repository with a Unit of Work implementation. The IRepository<T> and IUnitOfWork interfaces: public interface IRepository<T> { void Add(T item); void Remove(T item); IQueryable<T> Query(); } public interface IUnitOfWork : IDisposable { void SaveChanges(); } Entity Framework implementations of IRepository<T> and IUnitOfWork :

Onion Architecture - Repository Vs Service?

故事扮演 提交于 2019-11-28 16:00:34
问题 I am learning the well-known Onion Architecture from Jeffrey Palermo. Not specific to this pattern, but I cannot see clearly the separation between repositories and domain services. I (mis)understand that repository concerns data access and service are more about business layer (reference one or more repositories). In many examples, a repository seems to have some kind of business logic behind like GetAllProductsByCategoryId or GetAllXXXBySomeCriteriaYYY . For lists, it seems that service is

Unity: Implicit ResolvedParameter for unnamed registrations

房东的猫 提交于 2019-11-28 07:50:38
The UserService constructor has two parameters, a IUnitOfWork and a IUserRepository : public UserService(IUnitOfWork unitofWork, IUserRepository userRepository) { ... } I am using named registrations to differentiate between multiple instances of IUnitOfWork , so when registering the UserService with the Unity container, I need to explicitly specify the parameters using an InjectionConstructor : container.RegisterType<IUserService, UserService>( new InjectionConstructor( new ResolvedParameter<IUnitOfWork>("someContext"), new ResolvedParameter<IUserRepository>() ) ); Is it possible for new

What are the typical layers in an onion architecture?

冷暖自知 提交于 2019-11-28 06:35:23
I am currently studying the domain driven design, and try to apply it for a WPF project. I watched some tutorial videos, and read many articles, like : Onion archicecture dependencies in the same layer: Infrastructure and Web communicating http://eohmicrosoft.blogspot.fr/2012/08/laying-it-out-onion-architecture.html Domain Driven Design: Domain Service, Application Service I understood the focus on interfaces and inversion of control. I read there were some recurrent layer names (domain/core for the representation of the sphere of knowledge, infrastructures for persistance, application for ...

How can I solve this NHibernate Querying in an n-tier architecture?

旧时模样 提交于 2019-11-27 22:37:31
I've hit a wall with trying to decouple NHibernate from my services layer. My architecture looks like this: web -> services -> repositories -> nhibernate -> db I want to be able to spawn nhibernate queries from my services layer and possibly my web layer without those layers knowing what orm they are dealing with. Currently, I have a find method on all of my repositories that takes in IList<object[]> criteria . This allows me to pass in a list of criteria such as new object() {"Username", usernameVariable}; from anywhere in my architecture. NHibernate takes this in and creates a new Criteria

Dependency Resolution in Onion Architecture

寵の児 提交于 2019-11-27 20:20:43
问题 The Onion Architecture is a way of structuring applications to maintain separation of concern and loose coupling (example project at: http://onionarch.codeplex.com/). Dependency Injection/Resolution is a key aspect of this architecture, since it is used to tie all the layers together. The above link contains an example application on how to structure an ASP.NET MVC using the Onion layering. I really like it, but most of these examples use Ninject (which we all know is pretty slow). I was