public WorkflowContext(WorkflowContextData data, IAppServiceProvider provider) { if (data == null) { throw new ArgumentNullException(@"data"); } if (provider == null) { throw new ArgumentNullException(@"provider"); } Provider = provider; _dataContext = Provider.Find <IMultiDataContext>() ?? Provider.Get <IDataContext>(); Data = data; _docRepo = Provider.Get <IDocRepository>(); _userRepo = Provider.Get <IUserRepository>(); _defRepo = Provider.Get <IDocDefRepository>(); _orgRepo = Provider.Get <IOrgRepository>(); _enumRepo = Provider.Get <IEnumRepository>(); _sqlQueryBuilderFactory = Provider.Get <ISqlQueryBuilderFactory>(); _sqlQueryReaderFactory = Provider.Get <ISqlQueryReaderFactory>(); }
public static Guid GetCurrentUserId(this IAppServiceProvider provider) { var userDataProvider = provider.Find <IUserDataProvider>(); if (userDataProvider == null) { return(Guid.Empty); } return(userDataProvider.UserId); }