public virtual IRepository GetRepositoryFor(Type i) { var req = typeof(IRepository <>).MakeGenericType(i); var repo = _provider.GetService(req) as IRepository; if (repo != null) { return(repo); } var gen = GenericRepositoryType ?? typeof(DefaultRepository <>); var t = gen.MakeGenericType(i); return(Store.GetInstance(t)); }
public virtual Task Handle <TObject>(CrudEvent <TObject> item) where TObject : class { return(Task.Run(() => { try { var res = Store.GetInstance <IEntityHandler <TObject> >().Handle(item); RecordResult(res, item); } catch (Exception ex) { SubmitResult re = new SubmitResult(1); re.SetException(ex); RecordResult(re, item); Logger.WriteException(ex); throw; } })); }
protected T GetService <T>() where T : class { return(Store.GetInstance <T>()); }
protected T GetService <T>() { return(store.GetInstance <T>()); }