Skip to content

Instantly share code, notes, and snippets.

@ilude
Created January 27, 2011 22:46
Show Gist options
  • Save ilude/799465 to your computer and use it in GitHub Desktop.
Save ilude/799465 to your computer and use it in GitHub Desktop.
public class RepoConfiguration : Registry {
public RepoConfiguration() {
Scan(scan => {
scan.AssembliesFromApplicationBaseDirectory();
scan.AddAllTypesOf<IRepository>().NameBy(type => type.Name.Replace("Repository", string.Empty)); // register SqlServerRepository with name SqlServer
});
For<IRepository>().Use<SqlServerRepository>(); // define a default for no name calls
}
}
@schotime
Copy link

// The problem is we have this

puhlic interface IRepository {}
puhlic interface IUserInterface : IRepository {}
public class SqlServerUserRepository : IUserRepository
public class OracleUserRepository : IUserRepository

Maybe putting queries in seperate classes might work better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment