Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The solution looks very simple to me, why not just create <code>IReportService</code> and <code>IExportService</code> and let unity inject the concrete implementation to the serivce, and then refactor your classes slightly to look like this:</p> <pre><code>public interface IExportService { ExportService.Advertiser[] ExportAdvertisers(); } public class ConcreteExportService : IExportService { public ExportService.Advertiser[] ExportAdvertisers() { var service = new ExportService.export(); int advertiserID = 0; var advertisers = service.Advertisers(this.apiKey, advertiserID); return advertisers; } } public interface IReportService { ReportsService.Conversion[] Conversions(); } public class ConcreteReportService : IReportService { public ReportsService.Conversion[] Conversions() { var target = new ReportsService.reports(); DateTime from = new DateTime(2012, 1, 1); DateTime to = DateTime.Now.AddDays(1); int affiliateID = 0; int offerID = 0; var conversions = target.ConversionExport(this.apiKey, from, to, affiliateID, offerID, false); return conversions; } } public class MyWebServices : IMyWebServices { private string apiKey; private IExportService _exportService; private IReportService _reportService; public MyWebServices( IExportService exportService, IReportService reportService) { this._exportService = exportService; this._reportService = reportService; } public ExportService.Advertiser[] ExportAdvertisers() { return this._exportService.ExportAdvertisers(); } public ReportsService.Conversion[] Conversions() { return this._reportService.Conversions(); } public CakeWebService(string apiKey) { this.apiKey = apiKey; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload