public IReportTranslator GetTranslator(ReportFileType reportFileType) { var reportFileTypeString = reportFileType.ToString(); var reportTranslator = _unityContainer.Resolve <IReportTranslator>(reportFileTypeString); return(reportTranslator); }
public static string Get(ReportFileType value) { var type = value.GetType(); var memInfo = type.GetMember(value.ToString()).SingleOrDefault(); var attribute = memInfo.GetCustomAttribute <ReportFileTypeExtensionAttribute>(); if (attribute == null) { throw new ArgumentException(nameof(value)); } return(attribute._extension); }
public static IUnityContainer RegisterTranslator <T>(this IUnityContainer container, ReportFileType reportFileType, ReuseScope reuseScope) where T : IReportTranslator => container.RegisterType <IReportTranslator, T>(reportFileType.ToString(), reuseScope);