注册直接实现开放通用接口类型的Autofac类

时间:2018-03-14 15:57:45

标签: c# inversion-of-control autofac

我有一个界面:

public interface IFileParserService<ITxtFile>
{
    void Parse(IEnumerable<ITxtFile> rows);
}

我有一个不同的接口实现

public class ProductParserService : IFileParserService<TxtFileProduct>
{
    //implementation
}
public class CategoryParserService : IFileParserService<TxtFileCategory>
{
    //implementation
}

模型是:

public class TxtFileProduct : ITxtFile
{
}

public class TxtFileCategory : ITxtFile
{
}

使用Autofac注册这些类型的方法是什么? 谢谢。

0 个答案:

没有答案