我正在尝试找出在我的架构中使用身份验证密码的最佳位置.这是我的请求流程:
MVC3->MembershipProvider->AccountService->UserRepository->NHibernate->Database
Run Code Online (Sandbox Code Playgroud)
我在服务级别的哈希与存储库级别之间徘徊.我看到两者都有优势,但有谁知道这个标准的地方照顾这个?我将哈希密码存储在数据库中.
passwords domain-driven-design onion-architecture asp.net-mvc-3
我有以下Onion Architecture
框架.
Domain
Entities
- 对于我的域名实体Interfaces
- 对于我的域界面Services
- 对于我的域名服务Infrastructure
Data
- Fluent NHibernate
坚持不懈Interfaces
- 用于基础设施接口Logging
- 只是一个登录界面,以防我想将我的日志库切换到其他东西.Dependency Resolution
- 我的大多数IoC
注册都在这里.Services
Interfaces
- 应用程序服务接口进入这里,它们将在UI
项目中实现.Tests
Infrastructure Tests
- 用于测试基础设施服务等Domain Tests
- 用于测试域模型和服务Web
UI
- 用户界面项目,我实现应用程序服务,用户界面等...随着Domain Driven Development
一会识别Bounded Contexts
.互联网上的大多数文献都指出,每个文献都Bounded Context
需要抽象到自己的项目或命名空间中.
Domain Models
在一个项目中拥有所有项目而Domain Services
在另一个项 在不同的命名空间或项目中没有不同的有界上下文真的很重要吗?Model A
是my Bounded Context A
,但是 Bounded Context …
c# architecture design-patterns domain-driven-design onion-architecture
我正在关注我的Web API和AngularJS项目的Onion架构.在Infrastructure.DependencyResolution部分中,我使用的是Simple Injector.这是我的代码:
[assembly: PreApplicationStartMethod(typeof(IocConfig), "RegisterDependencies")]
namespace Infrastructure.DependencyResolution
{
public class IocConfig
{
private static Container _container;
public static void RegisterDependencies()
{
_container = new Container();
_container.Verify();
_container.RegisterWebApiRequest<IEntitiesContext>(() =>
{
return new MyContext();
});
_container.RegisterWebApiRequest<IUserRepository, UserRepository>();
_container.RegisterWebApiRequest<IAccountService, AccountService>();
_container.RegisterWebApiRequest<IUnitOfWork, UnitOfWork>();
}
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如果我尝试将url转到我的帐户控制器,我收到此错误:
尝试创建"AccountController"类型的控制器时发生错误.确保控制器具有无参数的公共构造函数.
我搜索并发现Simple Injector有一些不同的Web Api代码,如他们的网站所建议的那样:
// This is an extension method from the integration package.
container.RegisterWebApiControllers(GlobalConfiguration.Configuration);
Run Code Online (Sandbox Code Playgroud)
我也复制了它,但它不接受GlobalConfiguration.Configuration,我想是因为我在库项目中使用它.
当我在RegisterDependencies
方法中设置断点时,Visual Studio不会在断点处停止.
有人能告诉我去哪儿的路吗?
.net onion-architecture simple-injector asp.net-web-api asp.net-identity
我有一个场景我试图重构DDD.我有一个Batch,它是一个聚合和BatchEntries列表.创建批处理并添加BatchEntries后,将向批处理中的个人发送SMS,并且批处理的状态将从运行更改为已发布.
关于如何使设计更好的任何想法?该域有两个聚合Batch和BatchEntry,Batch是聚合根.
代码看起来像这样
public class Batch : EntityBase, IValidatableObject
{
public int BatchNumber { get; set; }
public string Description { get; set; }
public decimal TotalValue { get; set; }
public bool SMSAlert { get; set; }
public int Status { get; set; }
private HashSet<BatchEntry> _batchEntries;
public virtual ICollection<BatchEntry> BatchEntries
{
get{
if (_batchEntries == null){
_batchEntries = new HashSet<BatchEntry>();
}
return _batchEntries;
}
private set {
_batchEntries = new HashSet<BatchEntry>(value);
}
}
public static Batch Create(string description, …
Run Code Online (Sandbox Code Playgroud) 我要建立新的"企业解决方案"
所以我决定使用" 洋葱架构 ",因为我想要灵活的架构.
但我对"依赖性解决方案"的关注是新手.
据我所知,我应该将Factories" Implementations "放在这个Layer中,这个层引用了所有其他层.
然后,当DependencyResolution层和UI层中的FactoryImplementation没有引用"DependencyResolution Layer" 时,我想知道如何在" UI层 " 中创建IFactory的新实例
编辑::
感谢Erik先生
但是当我看到许多这些链接之后,当我想将"注册"实现"注册"到他们的"接口"时,我仍然有问题,因为我在UI项目中不能做这样的事情:
kernel.Bind<ITaxCalculator>()
.To<TaxCalculator>()
.WithConstructorArgument("rate", .2M);
Run Code Online (Sandbox Code Playgroud)
因为UI Project无法访问TaxCalculator
"实现".
architecture design-patterns dependency-injection onion-architecture