在之前的项目中,我使用BrockAllen.MembershipReboot作为我的会员服务提供商,但当时没有可用的NugetPackage,所以我复制了代码并稍微移动了一些东西。
我有一个类似的解决方案。
Solution.Common //database connection helpers, base repos, etc
Solution.DataModels //Contained UserAccount model (I put all datamodels here so I would never have to worry about circular references) All projects depended on this project.
Solution.Authentication //Services, like Add New Account were placed here
Solution.RandomServices
Solution.WebApp //MVC Project (Referenced Solution.Authentication)
好吧,现在我看到我可以通过NuGet安装MembershipReboot。但是,我不确定我应该将它安装到哪个项目中。
我当前的项目解决方案如下所示。
Sol.Common //Defines "BaseEntity" which UserAccountModel will need to inherit
Sol.Database //Contains all of the EF Entities, Repositories, and Migrations
Sol.Services //References Sol.Database to connect to repositories for data acess.
Sol.WebApp //References all of the above projects
GitHub页面上的所有示例都是单个项目解决方案。我不确定如何使用Nuget包来允许UserAccountModel继承BaseEntity。理想情况下,我在Sol.Database中使用IUserAccountRepository,在Sol.Services中使用UserAccountServices。