コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: DIHelper.cs プロジェクト: anthrax3/EasyLOB-3
        /// <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>();
        }
コード例 #3
0
 public static T GetService <T>()
 {
     return(_diManager.GetService <T>());
 }