onion-architecture

Error: Make sure that the controller has a parameterless public constructor (Autofac, WebApi2, & Onion Architecture)

旧街凉风 提交于 2019-12-11 06:19:46
问题 OK, I am getting the familiar error: An error occurred when trying to create a controller of type 'UserController'. Make sure that the controller has a parameterless public constructor. ---> System.ArgumentException: Type 'Project.WebApi.Controllers.UserController' does not have a default constructor at System.Linq.Expressions.Expression.New(Type type) I am building a WebApi2 project (no MVC front end) that use Onion Architecture, putting most of my start-up code in App_Start of a Bootstrap

best layer for placing dependency injection related code in layered proeject

老子叫甜甜 提交于 2019-12-10 23:53:47
问题 I am planning to follow onion architecture for my new application. the solution hierarchy is as follows Domain - where all the interfaces for the services and repositories defined. Infrastructure - this is the layer where all data access is placed. these classes typically implements interfaces defined in domain. Web - this is my presentation part of the application. inside the same layer i have separate for folder for implementing the services defined in domain. My plain is to use Dependency

Is the StaticFactory<T> in codecampserver a well known pattern?

妖精的绣舞 提交于 2019-12-10 18:01:43
问题 CodeCampServer source code contains a generic StaticFactory. I'm surmising that this is a key piece of the mechanism for how the framework plays well with Dependency Injection. Subclasses of which use it's DefaultUnconfiguredState to provide static access to, well, a Default Unconfigured State for themselves which the dependency resolution mechanism can replace with working stuff. I've not been able to find any documentation for this... Is there a good explanation in the book? (I'm awaiting

In an Onion type architecture, should the entities cross the outer layer?

假如想象 提交于 2019-12-10 11:43:17
问题 I've been trying to understand this new kind of architecture which names can be Onion architecture, Clean architecture, Ports and Adapters, etc. If I take the abstraction of Ports and Adapters, when I adapt my application for a particular port, is it ok for me to give the port an entity from inside my application? Or am I always supposed to adapt the entities also, to fit the port? Example: Say I have a Customer entity. I have a UI that uses my application. My UI calls through an Adapter to

Setting the identity of a Domain Entity

我们两清 提交于 2019-12-09 13:42:24
问题 All entities in the domain need to have identity. By inheriting from DomainEntity , I am able to provide identity to classes. City domain entity (stripped down for easy reading): public class City : DomainEntity, IAggregateRoot { public string Name { get; private set; } public Coordinate Coordinate { get; private set; } public City(string name, decimal latitude, decimal longitude) { Name = name; SetLocation(latitude, longitude); } public City(string name, decimal latitude, decimal longitude,

Autofac not working after update

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-08 10:42:07
问题 I have updated Autofac.Mvc from version 3.2.1 to 3.3.0, i also updated all other packages including EF, MVC, WebActivatorEx etc and after update it is giving error on my controller no parameterless constructor defined for this object I put a breakpoint in my initialization class and i found that it is not even hitting the breakpoint. I've a separate dependency resolution layer in my project and this is the code for initialization class [assembly: WebActivatorEx.PreApplicationStartMethod

WebActivator PreApplicationStartMethod not working

心已入冬 提交于 2019-12-08 01:36:44
问题 I'm making a new project following onin architecture. I have a separate project called "bootstrapper" that contain IOC and WebActivator.. My problem is that class that contain WebActivator not even loaded in debug ! May be i'm missing something ? [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(IocConfig), "RegisterDependencies")] public class IocConfig { public static void RegisterDependencies() { //.......... } } 回答1: Your Onion.Bootstrapper project corresponds to the outermost

EF6 and Onion architecture - database first and without Repository pattern

烂漫一生 提交于 2019-12-06 14:53:02
问题 I'm trying to put it all together for an new architecture for existing application. Existing application has a lot of business logic, so I thought that Onion architecture (or something like that - layered, decoupled) could be the right solution - http://jeffreypalermo.com/blog/the-onion-architecture-part-1/ All examples that I have seen use Repo/UoW (on top or ORM) pattern in Infrastructure layer (or DAL, or whatever the layer that actually connects to database is called). But I'm not sure

WebActivator PreApplicationStartMethod not working

本小妞迷上赌 提交于 2019-12-06 05:20:46
I'm making a new project following onin architecture. I have a separate project called "bootstrapper" that contain IOC and WebActivator.. My problem is that class that contain WebActivator not even loaded in debug ! May be i'm missing something ? [assembly: WebActivatorEx.PreApplicationStartMethod(typeof(IocConfig), "RegisterDependencies")] public class IocConfig { public static void RegisterDependencies() { //.......... } } Your Onion.Bootstrapper project corresponds to the outermost layer of your Onion Architecture. It's the only projects that references all the others. Using WebActivator

what is the difference between use dbset and mappers in EF7

家住魔仙堡 提交于 2019-12-06 04:39:16
问题 I started to work with .net core and Entityframework 7 in Onion Architecture ! i readed this tutorial and i think its best case for learning following subject. but one part of this tutorial made a big question inside my brain. like what you see at this linked page; at Data Layer we have some classes which are our model!! public class User : BaseEntity { public string UserName { get; set; } public string Email { get; set; } public string Password { get; set; } public virtual UserProfile