Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:50:44+00:00 2026-06-18T10:50:44+00:00

In a web app, its reasonable to use IoC/DI to get database sessions, DAOs

  • 0

In a web app, its reasonable to use IoC/DI to get database sessions, DAOs and whatever, because it’s not you that is calling the “event”, is the injector. You just need to declare the proper parameter in your event function.

But in a winforms app, its you and only you that calls the functions. There is no “query string handler” for you.


Really sounds impossible to change from

private void button1_Click(object sender, EventArgs e);

to

private void button1_Click(object sender, EventArgs e, DbSession dbSession);

and the “handler” automatically inject stuff for you.


So, the thing is: In winforms i just have to implement a singleton or static class that contains all my “util” instances, like SessionFactory and etc?
So for injection in winforms there is no design pattern or best practices?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T10:50:45+00:00Added an answer on June 18, 2026 at 10:50 am

    There are a couple of different flavors of Dependency Injection

    • Constructor Injection – Attach the dependencies through a constructor function at object creation
    • Setter Injection – Attach the dependencies through setter properties
    • Interface Injection – This is an odd duck (usage driven by specific DI tools)
    • Service Locator – Use a well known class that knows how to retrieve and create dependencies. Not technically DI, but this is what most DI/IoC container tools really do.

      Dependency Injection solves the issue (little bit of tight coupling) by putting the creation of object outside the scope of the container.

      check out detailed explanation with examples

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a web app that will use twitter as its primary log on
I am creating a scheduler web app that stores its data in a mysql
I have to test a web app and its API for UTF-8 strings. Webapp
I have a spring web app that uses Hibernate and Velocity. It's an MVC
WEB APP not native, no Objective-C This is so simple it hurts. <input type=date
Business: Practical background for all that is design of web-app, where web-page constructed from
I have a web application that relies on a MySQL database, for which I
I have to use Sync Framework 2.0 in our WPF app that will contain
Very basic question: I am coding a web app that has a handful of
When creating a web app it is common to use a wildcard domain and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.