Skip to content

Instantly share code, notes, and snippets.

@schotime
Created January 27, 2011 22:32
Show Gist options
  • Save schotime/799433 to your computer and use it in GitHub Desktop.
Save schotime/799433 to your computer and use it in GitHub Desktop.
public class RepositoryConvention : IRegistrationConvention
{
public void Process(Type type, StructureMap.Configuration.DSL.Registry registry)
{
if (type.IsClass && type.GetInterfaces().Where(x => x == typeof(IRepository)).Any())
{
if (type.Name.Contains(GlobalSettings.DbType))
{
Type specificInterface = type.GetInterfaces().Where(x => x != typeof(IRepository)).First();
registry.For(specificInterface).Use(type);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment