Base solution for your next web application

Activities of "pnw"

I wrote a nice website using Abp 1.0. Since I was only focusing on it at the time, my solution has the usual layout:

SLN Application (IDomainService, IApplicationService) Core (Entity) EntityFramework (AbpDbContext, IRepository) Web Api

Now I have a new project - a Windows Service - that uses the same database. Hence, I could reuse Core and EntityFramework, however I don't need Abp for a Window Service. Therefore, the exact same entities and dbContext can't be shared.

Also, both Web and Windows Service have similar services but in the latter I don't have IDomainService/DomainService or IApplicationService.

I'd like to have neutral projects that implement Core without Entity, EntityFramework using the regular DbContext, my own Install code that registers with Castle Windsor and common Services that don't need to inherit from DomainService.

I know that sound like I should just dump Abp from the web, however Abp makes working with Angular really nice. I just want to include my neutral Core, EntityFramework and Service projects (and register them with Castle Windsor using plain Castle instead of Abp's wrappers) in the Web and also use them in my Windows Service.

I've read all the Abp documentation and still don't know how to do this.

Thank you for replying.

Regarding your statement "If you want to use your regular classes in ABP, it will not be a problem.", I swapped out my website's Entities (the ones that inherit from Abp's Entity) with my POCO entities (basically the same classes but keeping their primary key IDs in the class and not inheriting from anything.)

Now Application services that inject the entities (wrapped in an IRepository) are complaining. For example:

private readonly IRepository<User, long> userRepository;

public UsersApplicationService
(
     IRepository<User, long> userRepo
)
{
     userRepository = userRepo;
}

The error is:

The type 'MyProject.Core.User' cannot be used as a type parameter 'TEntity' in the generic type or method 'IRepository<TEntity, TPrimaryKey>'. There is no implicit reference conversion from 'MyProject.Core.User' to 'Abp.Domain.Entities.IEntity<long>'.

My classes that use a int instead of a long (e.g. IRepository<Company>) give a similar error. I thought maybe since Entity automatically adds 'Id' to each descendent, that adding 'Id' to my POCO would help but the error persists.

With respect to Dependency Injection, I think I get the concept and don't expect that to be a problem.

The only other alternative to generic repositories is to create custom repositories that are still based on IRepository<TEntity, TPrimaryKey>.

Since I don't want ABP in my Windows Service, you are saying I'm out of luck trying to maintain centralized Core and EntityFramework projects and a shared Service project that holds a couple "Domain" services?

What did you mean initially by "If you want to use your regular classes in ABP, it will not be a problem"?

Showing 21 to 23 of 23 entries