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

  • Home
  • SEARCH
  • 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 6837871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:31:43+00:00 2026-05-26T23:31:43+00:00

I am creating an API and I want to expose an interface called IReportFields,

  • 0

I am creating an API and I want to expose an interface called IReportFields, I want the client to implement this class and basically get fields from whatever datasource (usually database).

Within my IReport interface I want to take in an instance of the IReportFields (could be more than one, in my app I have at least 4), then do whatever I need to do within that interface, usually it will be something like build report or whatever.

So for example:

public interface IReportField
{
 ICollection<ReportField> GetFields();
}

There could be various type of report fields e.g. they could derive for 3 or 4 different database tables etc…

Then on my main interface I will:

public interface IReport
{
 string GetReport(IReportField[] field);
}

Question:

IReportFields can have multiple implementations, i.e. many different types of fields, how do I call the method GetReport keeping in mind I am using Ninject, how do I wire my interfaces together?

//this bit is where I am stuck, how do I pass in the params as I dont want a hard dependancy on a class that requires me to get a report

 IFieldReport field1 = new FieldImp1();
 IFieldReport field2 = new FieldImp2();

 var report = GetReport(feild1, field2);
  • 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-05-26T23:31:43+00:00Added an answer on May 26, 2026 at 11:31 pm

    You can use Constructor injection to have all wired up IFieldReports such as you have the wiring as follows:

    IKernel kernel = new StandardKernel();
    
    kernel.Bind<IReportField>().To<FieldImp1>();
    kernel.Bind<IReportField>().To<FieldImp2>();
    kernel.Bind<IReport>().To<ReportImpl>();
    

    And you have a ReportImpl like this:

    public class ReportImpl : IReport
    {
        public ReportImpl(List<IReportField> fieldReports)
        {
            // you now have all the wires to IReportField in fieldReports parameter
            foreach(IReportField fieldReport in fieldReports)
            {
                var fields = fieldReport.GetFields();
                // do whatever with the fields
            }
        }
    }
    

    Please let me know if I got it wrong

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

Sidebar

Related Questions

I am going about creating a service API to get latest articles from a
I'm creating an API for my Rails app, and I want to track how
I'm creating my own API for a game-statistics system (in PHP). And I want
I am creating an application which uses the facebook api, and I want facebook
I am creating a REST API in ASP.NET MVC. I want the format of
I'm creating an API for a Rails app and I want to return User
i am creating an API and i want to switch between power plans [Balanced
I want API support for: GET /api/spam/{id} POST /api/spam body: {'name': 'green spam'} I
I want to use this gem in my api application https://github.com/seangeo/auth-hmac/ I have a
I am creating an AJAX API for a web service and I want to

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.