private static void DIManagerDemo() { Console.WriteLine("\nUnityManager Demo\n"); try { IDIManager diManager = DIHelper.GetService <IDIManager>(); Console.WriteLine(diManager.ToString()); IIdentityUnitOfWork unitOfWork = diManager.GetService <IIdentityUnitOfWork>(); Console.WriteLine(unitOfWork.ToString()); IIdentityGenericApplication <User> application = diManager.GetService <IIdentityGenericApplication <User> >(); Console.WriteLine(application.ToString()); ZOperationResult operationResult = new ZOperationResult(); User user = application.Get(operationResult, x => x.UserName.ToLower() == "administrator"); Console.WriteLine(user.UserName); } catch (Exception exception) { WriteException(exception); } }
/// <summary> /// Setup. /// </summary> /// <param name="diManager">DI Manager</param> /// <param name="mapper">AutoMapper Mapper</param> public static void Setup(IDIManager diManager, IMapper mapper) { DIManager = diManager; Mapper = mapper; EnvironmentManager = diManager.GetService <IEnvironmentManager>(); LogManager = diManager.GetService <ILogManager>(); }
public static T GetService <T>() { return(_diManager.GetService <T>()); }