示例#1
0
 public ConnectedDbServiceBase(
     IDataServiceBase <TModel, TId> dataServiceBase,
     IContextFactory contextFactory,
     ILogger logger,
     IMapper mapper
     ) : base(contextFactory, logger, mapper)
 {
     _dataServiceBase = dataServiceBase;
 }
示例#2
0
 public HubServiceBase(
     IAccessTokenProvider tokenProvider,
     IConfiguration configuration,
     IDataServiceBase <TDto, TId> dataServiceBase,
     IMapper mapper)
 {
     _tokenProvider   = tokenProvider;
     _configuration   = configuration;
     _dataServiceBase = dataServiceBase;
     _mapper          = mapper;
 }
示例#3
0
        /// <summary>
        /// Registers a <see cref="IDataServiceBase{T}" />.
        /// All <see cref="DataRequest" />s are automatically subscribed to.
        /// Other <see cref="Broker" />s can access the service by publishing <see cref="DataRequest" />s.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        public void RegisterDataService <T>() where T : IDataServiceBase <DbContext>, new()
        {
            if (_isServiceRegistered)
            {
                throw new DataContextException("A dataservice is already registered with this context.");
            }

            try
            {
                InitializeDisposeLock.EnterWriteLock();

                if (_isServiceRegistered)
                {
                    throw new DataContextException("A dataservice is already registered with this context.");
                }

                IDataServiceBase <DbContext> dataService =
                    Activator.CreateInstance(typeof(T)) as IDataServiceBase <DbContext>;

                if (dataService == null)
                {
                    throw new DataContextException(
                              string.Format("Could not create an instance of the given '{0}' of type '{1}'.",
                                            typeof(IDataServiceBase <DbContext>).Name, typeof(T).AssemblyQualifiedName()));
                }

                _serviceType   = dataService.GetType();
                _dbContextType = TypeHelper.GetGenericArgumentOfBaseType(dataService.GetType(), typeof(DbContext));

                if (_dbContextType == null)
                {
                    throw new DataContextException(
                              string.Format("Could not determine the '{0}' type on the given '{1} of type '{2}'.",
                                            typeof(DbContext).Name, typeof(IDataServiceBase <DbContext>).Name, typeof(T).AssemblyQualifiedName()));
                }

                _dbContext  = Activator.CreateInstance(_dbContextType) as DbContext;
                ServiceHost = new System.Data.Services.DataServiceHost(_serviceType,
                                                                       new[] { new Uri(_peer.Node.Contact.DataContextUrl()) });

                _isServiceRegistered = true;
            }
            finally
            {
                InitializeDisposeLock.ExitWriteLock();
            }
        }
示例#4
0
 /// <summary>
 /// The constructor for the QFControllerBase class.
 /// </summary>
 /// <param name="dataService">The data service used to return data to the views contained within this class.</param>
 /// <param name="securityManager">The <see cref="QuickFrame.Security.QuickFrameSecurityManager"/>  used to apply security to functions within this class.</param>
 public QfControllerBase(IDataServiceBase <TEntity> dataService, QuickFrameSecurityManager securityManager)
 {
     _dataService     = dataService;
     _securityManager = securityManager;
     _viewOptions     = new ViewOptions {
         PerPageList = new List <SelectListItem>()
         {
             new SelectListItem {
                 Text = "25", Value = "25"
             },
             new SelectListItem {
                 Text = "50", Value = "50"
             },
             new SelectListItem {
                 Text = "75", Value = "75"
             },
             new SelectListItem {
                 Text = "100", Value = "100"
             },
         },
         PerPageDefault = "25"
     };
 }
示例#5
0
 public AppServiceBase(IUnitOfWorkService uow)
 {
     _uow         = uow;
     _serviceBase = _uow.Service <IDataServiceBase <TEntity> >();
 }
示例#6
0
 public QfControllerBase(IDataServiceBase <TEntity> dataService, QuickFrameSecurityManager securityManager, IOptions <ViewOptions> viewOptions)
 {
     _dataService     = dataService;
     _securityManager = securityManager;
     _viewOptions     = viewOptions.Value;
 }
示例#7
0
 public QfControllerCore(IDataServiceBase <TEntity> dataService, QuickFrameSecurityManager securityManager, IOptions <ViewOptions> viewOptions)
     : base(dataService, securityManager, viewOptions)
 {
 }