c# - WinForms N-Tier App with DI, Repository and -


i'm building simple winforms app, i'm using n-tier architecture, dependecy injection (with simple injector), entity framework code first, repository , unit of work patterns.

  • ui layer.
    • forms.
  • business logic layer.
    • business objects "managers" (classes expose business processes).
  • data access layer
    • repositories.
    • database context.

basically, know can register objects on container on app's entry point (program.cs), works objects accessible ui, rules out data access layer objects.

so, how can register objects business logic layer since it's class library.

thanks in advance.

you need make distinction between dependency , reference.

you're correct in saying ui should not have dependency on dataaccesslayer. means shouldn't hard-wired sql server code (to give example). doesn't mean can't reference project.

to solve problem, reference projects ui (which entry point application).

the fact if create references this: ui => business logic => data access, you're referencing data layer ui, indirectly.

i've written post explains in further detail:

https://www.kenneth-truyers.net/2013/05/12/the-n-layer-myth-and-basic-dependency-injection/


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -