I have inherited some code which is still a work in progress. I think it has a glaring architecture problem:
It has a project that contains all the domain entities (domain layer) and a project that contains all the application services (application layer). The application layer has a dependency on the domain layer. So far so good. Then there is a 3rd project which contains all the view models for the application layer. I'll call this the view model layer. Fine.
Problem is, I've realised that the domain layer has an active dependency on the view model layer. What it is, is they've put a bunch of meta data for every entity in here, mostly the max length of various string fields, and both the domain entities and the view models are referencing these constant values.
I'm pretty sure it's very bad to have your domain models dependant on view models in this way. I discovered this because I wanted to use the domain model for something in a view model and discovered that I couldn't because of the circular reference it would cause.
So my question is this: how bad is this architecture? Or am I actually wrong and it's not a problem at all. I actually can't find an answer to this, possibly because it's considered so obvious. Also, what do people normally do for field meta-data (like max length) which is common to both the domain entities and the view models? Seems a waste to write it out in more than one place.
I'm using c# MVC with angular client for what it's worth.
Thanks in advance.