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 116921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:15:16+00:00 2026-05-11T03:15:16+00:00

I am having a really hard time reconciling IoC, interfaces, and events. Let’s see

  • 0

I am having a really hard time reconciling IoC, interfaces, and events. Let’s see if I can explain this without writing a book.

I’m just getting started with IoC and I’m playing with Spring. We have a simple data layer that was built long before EF or the others. One of the classes is a DBProcedure which has some methods and events.

I created an IDBProcedure interface that the ‘real’ DBProcedure class implements. In TDD fashion I’d like to be able to swap out the ‘real’ DBProcedure class for another that implements the same interface for testing. To me, this means that the IDBProcedure interface should be defind in a different namespace/project than my data layer, right?

But a DBProcedure can raise some events and those events deliver custom EventArgs-derived classes. Does that mean that the EventArgs-classes need to be defined outside the data layer too? Seems like it to make the interface work, but that seems bad because it spreads data-layerness around?

On the other hand maybe I have the wrong idea – is it ok to include the data layer namespace when I’m testing to get interface and event definitions even though I’m not using any of the ‘real’ classes?

  • 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. 2026-05-11T03:15:16+00:00Added an answer on May 11, 2026 at 3:15 am

    Yes, you need to move the interfaces and all the types it depends on somewhere, because you do not want the interfaces module to depend on the implementations.

    The typical choice for this is one of two alternatives

    Impl ----> Api <---- client 

    (Implementation depends on api, client depends on api, everything in api module)

    Impl ----> Api <----- client \           |          /  \          V         /   ------->Model<------ 

    Here everyone depends on a common ‘model’ module, and this contains the enums and such. The advantage of this version is that you can have multiple API modules share the same common enums and other artifacts. (Because you really don’t want API’s to depend on other API modules usually)

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

Sidebar

Related Questions

I'm having a really hard time getting my head around using REST-style URLS. Can
I am having a really hard time attempting to debug LINQ to SQL and
Im having a really hard time figuring out how to specify a good search
I'm having a really hard time understanding delegates and object inheritance (if I may
I just start playing with GWT I'm having a really hard time to make
I just setup a wordpress blog and I am having a really hard time
I'm using Microsoft Open XML SDK 2 and I'm having a really hard time
I'm having a really hard time when trying to cancel requests in an NSOperationQueue.
I'm having a really hard time finding any examples that are close to what
I am having a really hard time installing ADT 9.0.0 for Eclipse (plain jane)

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.