/// <summary> /// Creates an instance of the type. /// </summary> /// <param name="applicationContext"></param> /// <param name="dashboard"></param> public DataPortal(ApplicationContext applicationContext, IDashboard dashboard) { ApplicationContext = applicationContext; Dashboard = dashboard; var authProviderType = GetAuthProviderType("CslaAuthorizationProvider"); if (null == authProviderType) { throw new ArgumentNullException(nameof(authProviderType), Resources.CslaAuthenticationProviderNotSet); } if (!typeof(IAuthorizeDataPortal).IsAssignableFrom(authProviderType)) { throw new ArgumentException(Resources.AuthenticationProviderDoesNotImplementIAuthorizeDataPortal, nameof(authProviderType)); } //only construct the type if it was not constructed already if (null == _authorizer) { lock (_syncRoot) { if (null == _authorizer) { _authorizer = (IAuthorizeDataPortal)Activator.CreateInstance(authProviderType); } } } if (InterceptorType != null) { if (_interceptor == null) { lock (_syncRoot) { if (_interceptor == null) { _interceptor = (IInterceptDataPortal)Activator.CreateInstance(InterceptorType); } } } } }
static DataPortal() { Dashboard = Server.Dashboard.DashboardFactory.GetDashboard(); }