コード例 #1
0
        public void TestVoluntarioModelInjection()
        {
            IVoluntarioQuery          voluntario = null;
            VoluntarioQueryIocManager iocManager = new VoluntarioQueryIocManager(base.Config);

            voluntario = iocManager.GetCurrentIVoluntarioQueryImplementation();
            Assert.IsNotNull(voluntario);

            Assert.IsTrue(voluntario.GetType().IsClass);
        }
コード例 #2
0
        public IVoluntarioQuery GetCurrentImplementation()
        {
            IVoluntarioQuery obj = null;

            foreach (var type in typeof(IVoluntarioQuery).Assembly.DefinedTypes)
            {
                if (type.IsClass && type.FullName.EndsWith(_currentImplementation))
                {
                    obj = (IVoluntarioQuery)Assembly.Load(typeof(IVoluntarioQuery).Assembly.FullName).CreateInstance(type.FullName);
                    break;
                }
            }
            return(obj);
        }