Questions tagged [open-generics]
54 questions
0
votes
2 answers
StructureMap error resolving Open Generic dependency
So I've wired up my open generic plugin in StructureMap like so
scan.ConnectImplementationsToTypesClosing(typeof(IRepository<>));
But still get the dreaded
No Default Instance defined for PluginFamily…

Michael Brown
- 9,041
- 1
- 28
- 37
0
votes
0 answers
Register decorator with open generics
I was hoping to get some feedback on how to register decorators for some specific contracts and implementations.
Here is what i have
A marker query interface like such
public interface IQueryBase
{
}
A query handler contract like such
public…

nesh_s
- 399
- 4
- 19
0
votes
1 answer
Get all AsClosedTypesOf registration variants from the Autofac Builder
Lets assume these classes/interfaces:
public interface ICommand
{
}
public class SomeCommand : ICommand
{
}
public interface ICommandHandler where T : ICommand
{
void Handle(T arg);
}
public class SomeCommandHandler :…

Beachwalker
- 7,685
- 6
- 52
- 94
0
votes
1 answer
C# Open generic type comparison. Generic<> is "parent" of Generic?
I have a class MyGeneric, and some cached data created from type MyGeneric, MyGeneric, MyGeneric... etc.
Somewhere I have to check certain data to see if it is MyGeneric, I code like this:
if (data is MyGeneric<>) { // can't…

ineztia
- 815
- 1
- 13
- 29
0
votes
1 answer
Register and resolve open generic types with many generic parameters with Autofac
I would like to resolve an open generic service due to a generic interface. I use autofac.
Each concrete service works only with concrete classes.
I can resolve only one service with single generic param [see SingleOpenGenericResolveTest]. Is it…

Lyo Ko
- 1
- 1
0
votes
0 answers
Registering structuremap with open generic types result in error
Open Generic Type
public interface ICrudRepository where TEntity : class, new()
{
Implementation
public class EmployeeRepository:ICrudRepository
{
Registration
private static void OnRegistry(ConfigurationExpression…

Deeptechtons
- 10,945
- 27
- 96
- 178
0
votes
1 answer
Autofac: Open generics and base interfaces
Given the following interfaces and classes, is there a way in Autofac to
Register a Provider for all classes that have a ProviderAttribute, with T being the type of such a class (Think registering open generics and resolving them with Autofac's…

kitsune
- 11,516
- 13
- 57
- 78
0
votes
1 answer
Structuremap WhatDoIHave says I have it. ObjectFactory says I don't
Jeez louise, I'm trying to retro fit a plague ridden legacy app with SM and running into all sorts of strangeness. So I apologize for all the strange questions.
so I have this code
var whatDoIHave = ObjectFactory.Container.WhatDoIHave();
var…

Raif
- 8,641
- 13
- 45
- 56
0
votes
1 answer
autofac open generic iRepository xml configuration
I would like to use autofac and the Repository Pattern (iRepository) but can't seem to see a way to configure autofac using XML configuration.
As anyone else come across this issue?

Vince
- 165
- 1
- 14