/// <summary> /// 注册单例仓储,请确保<paramref name="repository"/>是线程访问安全的 /// </summary> /// <typeparam name="TRepository"></typeparam> /// <typeparam name="TObject"></typeparam> /// <param name="repository"></param> public static void Register <TRepository>(IRepository repository) where TRepository : IRepository { RepositoryRegistrar.Register <TRepository>(repository); }
private static Type GetRepositoryTypeByRegister(Type repositoryInterfaceType) { return(RepositoryRegistrar.GetRepositoryType(repositoryInterfaceType)); }
private static TRepository GetRepositoryByRegister <TRepository>() where TRepository : class, IRepository { return(RepositoryRegistrar.GetRepository(typeof(TRepository)) as TRepository); }