Skip to content

Add lifestyles for concrete types #77

Description

@ipjohnson

Currently all concrete types that are auto registered by the container are assumed to be transient. It would be nice to be able to provide a Func<Type,ICompiledLifeStyle> delegate that allows the user to provide lifestyles for concrete types.

An example implementation could be

public static ICompiledLifeStyle SingletonLifeStylePicker(Type type)
{
   return type.Name.EndsWith("Singleton") ? new SingletonLifeStyle() : null;
}

var container = new DependencyInjectionContainer(c => c.ConcreteLifeStylePicker = SingletonLifeStylePicker);

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions