I have the following code that worked before I changed to use generics for the service:
Update: I added some more class and interface info in response to comments:
public class Service<T1,T2> : BaseService, IService<T1>
where T1 : IAuditableTable
where T2 : IAuditableTable
{
private IAzureTable<T1> _T1repository;
private IAzureTable<T2> _T2repository;
public Service(string ds)
{
base.Initialize(ds);
_T1repository = StorageHelper.GetTable<T1>(ds);
_T2repository = StorageHelper.GetTable<T2>(ds);
}
public IEnumerable<AdminDetail> ShowDetails()
{
return base.ShowDetails(_T1repository, _T2repository);
}
...
and
public IEnumerable<AdminSummary> ShowSummary<T1, T2>(
IAzureTable<T1> master, IAzureTable<T2> detail)
where T1 : AuditableTable
where T2 : AuditableTable
{
...
public abstract class AuditableTable : TableServiceEntity, IAuditableTable
{
...
public interface IAzureTable<T> : IInitializer
public interface IService<T>
where T : IAuditableTable
{
IEnumerable<AdminSummary> ShowSummary();
}
private IService<Account> _account;
vm.AdminSummaries = _account.ShowSummary(); << calls the report
When I try to compile I get the following message:
The type ‘T2’ cannot be used as type parameter ‘T2’ in the generic type or
method ‘Services.BaseService.ShowSummary<T1,T2>(AzureToolkit.IAzureTable<T1>, AzureToolkit.IAzureTable<T2>)’. There is no boxing conversion or type parameter conversion from ‘T2’ to ‘Storage.Models.AuditableTable’.
You might need the
classconstraint onT2.