buff
buff

Reputation: 331

Orchard Autofac throws not assignable exception

I have the following service:

public Interface IService<T> : IDependency {
      T Execute();
}

and:

   public class Service<T> : IService<T> Where T : class, new() {
          T Execute();
   }

Orchard Crashes and throws the following exception:

The type 'Service`1[T]' is not assignable to service 'IService`1'.

any help is much appreciated.

Upvotes: 0

Views: 79

Answers (1)

Hazza
Hazza

Reputation: 6591

Do you really need T to be on the service anyway? Just do:

public interface IService : IDependency {
  T Execute<T>();
}

Then you get the benefits of Orchard's automatic dependency injection

Upvotes: 1

Related Questions