Created
January 27, 2011 22:32
-
-
Save schotime/799433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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