Esempio n. 1
0
        public virtual IRepository <T> GetRepositoryFor <T>() where T : class
        {
            var i    = typeof(T);
            var repo = _provider.GetService <IRepository <T> >();

            if (repo != null)
            {
                return(repo);
            }
            if (GenericRepositoryType != null)
            {
                var t = GenericRepositoryType.MakeGenericType(typeof(T));
                return((IRepository <T>)Store.GetInstance(t));
            }
            return(Store.GetInstance <IRepository <T> >());
        }
Esempio n. 2
0
        public override IRepository <T> GetRepositoryFor <T>()
        {
            var i    = typeof(T);
            var repo = _provider.GetService <IRepository <T> >();

            if (repo != null)
            {
                appendCollectionId(repo);
                return(repo);
            }

            if (GenericRepositoryType != null)
            {
                var t = GenericRepositoryType.MakeGenericType(typeof(T), typeof(TContext));
                return((IRepository <T>)Store.GetInstance(t));
            }
            return(Store.GetInstance <Repository <T, TContext> >(r => appendCollectionId(r)));
        }