Exemple #1
0
        /// <summary>
        /// 初始化 <see cref="DefaultRepositoryProvider{TEntity}"/> 类的新实例。
        /// </summary>
        /// <param name="contextService"></param>
        public DefaultRepositoryProvider(DefaultContextService contextService)
        {
            _contextService = contextService;
            _provider       = contextService.Provider;
            _database       = contextService.Database;

            QueryProvider = new QueryProvider(new EntityQueryProvider(contextService));
            Queryable     = new QuerySet <TEntity>(QueryProvider);
        }
Exemple #2
0
        /// <summary>
        /// 初始化 <see cref="DefaultRepositoryProvider"/> 类的新实例。
        /// </summary>
        /// <param name="service"></param>
        public DefaultRepositoryProvider(IContextService service)
        {
            context = (DefaultContextService)service;

            var entityQueryProvider = new EntityQueryProvider(this.context);

            context.As((Action <IEntityPersistentInstanceContainer>)(s => entityQueryProvider.InitializeInstanceName(s.InstanceName)));

            QueryProvider = new QueryProvider(entityQueryProvider);
            Queryable     = new QuerySet <TEntity>(QueryProvider);
        }