I have Domain assembly and SqlServerRepository assembly.
SqlServerRepository assembly has a reference on Domain assembly, Domain assembly doesn't have reference on other assemblies.
Domain assembly has interface IRepository (and others for repository), because domain logic works only with interface types and doesn't think about concrete types.
SqlServerRepository assembly implements interface IRepository (which is contained in the Domain assembly).
And it's ok, I can mock IRepository, can use OracleRepository implementation and another...
But I think I have some architecture problem...
SqlServerRepositorycan't work without theDomainassembly- On another hand, if I put interfaces in
SqlServerRepositoryassembly, theDomainwill not work withoutSqlServerRepositoryassembly, and if I createOracleServerRepositoryassembly, I must useSqlServerRepositorytoo, because I put the interfaces in theSqlServerRepositoryandDomainalredy uses them. - Where should I map database objects to domain? In the
SqlServerRepositoryor in theDomainassembly?
I thought about an assembly which contains only interfaces, and Domain and SqlServerRepository reference it, but I think it is overhead for my project (microservice)
So, what must I do?
Aucun commentaire:
Enregistrer un commentaire