Question

I'm learning ServiceStack and Onion Architecture, and I have a question that seems so basic I feel I'm missing something.

I have three projects, an Api, Core, and Infrastructure.

I have ServiceStack in an API project. I have my entity objects in my Core project, my data access classes are in my Infrastructure project. I have to decorate my entity objects with attributes so that the Orm Lite code knows how to act with them (creating tables, etc). These are attributes like [AutoIncrement] and [Index].

I have to reference ServiceStack in my core to get access to the attributes, and core, up to this point, hasn't had a dependency on anything, and this breaks the idea of the Onion Architecture.

What am I missing? How do I allow OrmLite in the Infrastructure project to handle the data access for my entities while the entities are in core?

Was it helpful?

Solution

This is a problem with Ormlite. I have created a ticket long time back to move the Attributes to the common assembly but the code change did not happen yet. If you can move the attributes to the common assembly and do a pull request, we will have it added.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top