zkweb-framework / ZKWeb

A flexible web framework supports .Net Framework and .Net Core
MIT License
484 stars 141 forks source link

IOC resolve abstract class throw exception #14

Closed dynh closed 5 years ago

dynh commented 5 years ago
    public abstract class ClassService {
        public abstract string GetName();
    }

        [ExportMany(ContractKey = "d")]
        public class TestResolveFromAbstract : ClassService
        {
            public override string GetName()
            {
                return "sunny";
            }
        }

        Assert.Equals(container.Resolve<ClassService>(IfUnresolved.Throw, "d").GetName(), "sunny");

The exception message: no factory registered to type ZKWebStandard.Tests.IocContainer.ContainerTest+ClassService and service key d

303248153 commented 5 years ago

How did you register the service to container? the following methods are supported.

303248153 commented 5 years ago

Close since no feedback after months, if you have any issue please reopen it