c# - Data access within an aspect -


say have following layered architecture...

enter image description here

i want implement aspect requires form of data access. each of projects in stack have reference aspect framework. therefore cannot have aspect assembly reference data access layer due circular references.

so how should go doing data access within aspect?

this solved using run-time dependencies.

best approach inversion of control pattern.

your data access may implement interfaces , implementation may retrieved during run-time resolving implements whole interface using inversion of control framework castle windsor or ninject.

your aspects interact data layer whole interfaces instead of design-time references, you'll avoid compile-time circular references.

i'd add clarification: run-time dependency resolving isn't silverbullet produce circular reference avoid compile-time errors.

sometimes implementations may part of assembly once referenced in design-time may end in circular reference, coincidence: may in assembly or in implementations-only one, or third-party assembly. knows ;)


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -