public static Expression ResolveExpression (
        Expression expression,
        IMappingResolver resolver,
        IMappingResolutionStage stage,
        IMappingResolutionContext context,
        UniqueIdentifierGenerator generator)
    {
      ArgumentUtility.CheckNotNull ("expression", expression);
      ArgumentUtility.CheckNotNull ("resolver", resolver);
      ArgumentUtility.CheckNotNull ("stage", stage);
      ArgumentUtility.CheckNotNull ("context", context);
      ArgumentUtility.CheckNotNull ("generator", generator);

      var entityIdentityResolver = new EntityIdentityResolver (stage, resolver, context);
      var comparisonSplitter = new CompoundExpressionComparisonSplitter();
      var namedExpressionCombiner = new NamedExpressionCombiner (context);
      var groupAggregateSimplifier = new GroupAggregateSimplifier (stage, context);

      var visitor1 = new ResolvingExpressionVisitor (
          resolver, stage, context, generator, entityIdentityResolver, comparisonSplitter, namedExpressionCombiner, groupAggregateSimplifier, false);
      var result1 = visitor1.VisitExpression (expression);

      var visitor2 = new ResolvingExpressionVisitor (
          resolver, stage, context, generator, entityIdentityResolver, comparisonSplitter, namedExpressionCombiner, groupAggregateSimplifier, true);
      var result2 = visitor2.VisitExpression (result1);
      return result2;
    }
 public void SetUp ()
 {
   _stageMock = MockRepository.GenerateStrictMock<IMappingResolutionStage>();
   _resolverMock = MockRepository.GenerateMock<IMappingResolver>();
   _mappingResolutionContext = new MappingResolutionContext();
   _generator = new UniqueIdentifierGenerator();
   _groupAggregateSimplifier = MockRepository.GenerateStrictMock<IGroupAggregateSimplifier> ();
 }
 public DefaultMappingResolutionStage (IMappingResolver resolver, UniqueIdentifierGenerator uniqueIdentifierGenerator)
 {
   ArgumentUtility.CheckNotNull ("resolver", resolver);
   ArgumentUtility.CheckNotNull ("uniqueIdentifierGenerator", uniqueIdentifierGenerator);
   
   _uniqueIdentifierGenerator = uniqueIdentifierGenerator;
   _resolver = resolver;
 }
 public void SetUp ()
 {
   _resolverMock = MockRepository.GenerateStrictMock<IMappingResolver>();
   _unresolvedJoinInfo = SqlStatementModelObjectMother.CreateUnresolvedJoinInfo_KitchenCook();
   _generator = new UniqueIdentifierGenerator();
   _stageMock = MockRepository.GenerateStrictMock<IMappingResolutionStage> ();
   _mappingResolutionContext = new MappingResolutionContext();
 }
    public static IResolvedTableInfo ResolveTableInfo (ITableInfo tableInfo, IMappingResolver resolver, UniqueIdentifierGenerator generator, IMappingResolutionStage stage, IMappingResolutionContext context)
    {
      ArgumentUtility.CheckNotNull ("tableInfo", tableInfo);
      ArgumentUtility.CheckNotNull ("resolver", resolver);
      ArgumentUtility.CheckNotNull ("stage", stage);
      ArgumentUtility.CheckNotNull ("context", context);

      var visitor = new ResolvingTableInfoVisitor (resolver, generator, stage, context);
      return (IResolvedTableInfo) tableInfo.Accept (visitor);
    }
 public void SetUp ()
 {
   _stageMock = MockRepository.GenerateMock<IMappingResolutionStage>();
   _resolverMock = MockRepository.GenerateMock<IMappingResolver>();
   _unresolvedTableInfo = SqlStatementModelObjectMother.CreateUnresolvedTableInfo (typeof (Cook));
   _resolvedTableInfo = SqlStatementModelObjectMother.CreateResolvedTableInfo (typeof (Cook));
   _generator = new UniqueIdentifierGenerator();
   _sqlStatement = SqlStatementModelObjectMother.CreateSqlStatement_Resolved (typeof (Cook));
   _mappingResolutionContext = new MappingResolutionContext();
 }
    public Expression ResolveReference (SqlTableBase sqlTable, IMappingResolver mappingResolver, IMappingResolutionContext context, UniqueIdentifierGenerator generator)
    {
      ArgumentUtility.CheckNotNull ("sqlTable", sqlTable);
      ArgumentUtility.CheckNotNull ("mappingResolver", mappingResolver);
      ArgumentUtility.CheckNotNull ("context", context);
      ArgumentUtility.CheckNotNull ("generator", generator);

      var entity = (SqlEntityExpression) mappingResolver.ResolveSimpleTableInfo (this, generator);
      context.AddSqlEntityMapping (entity, sqlTable);
      return entity;
    }
    protected ResolvingTableInfoVisitor (IMappingResolver resolver, UniqueIdentifierGenerator generator, IMappingResolutionStage stage, IMappingResolutionContext context)
    {
      ArgumentUtility.CheckNotNull ("generator", generator);
      ArgumentUtility.CheckNotNull ("resolver", resolver);
      ArgumentUtility.CheckNotNull ("stage", stage);
      ArgumentUtility.CheckNotNull ("context", context);

      _resolver = resolver;
      _generator = generator;
      _stage= stage;
      _context = context;
    }
    public void SetUp ()
    {
      _resolverMock = MockRepository.GenerateMock<IMappingResolver>();
      _uniqueIdentifierGenerator = new UniqueIdentifierGenerator();

      _unresolvedTableInfo = SqlStatementModelObjectMother.CreateUnresolvedTableInfo (typeof (Cook));
      _sqlTable = SqlStatementModelObjectMother.CreateSqlTable (_unresolvedTableInfo);
      _fakeResolvedSimpleTableInfo = SqlStatementModelObjectMother.CreateResolvedTableInfo (typeof (Cook));

      _stage = new DefaultMappingResolutionStage (_resolverMock, _uniqueIdentifierGenerator);

      _mappingResolutionContext = new MappingResolutionContext();
    }
    public void SetUp ()
    {
      _stageMock = MockRepository.GenerateStrictMock<IMappingResolutionStage>();
      _resolverMock = MockRepository.GenerateStrictMock<IMappingResolver>();
      _context = new MappingResolutionContext();

      _entityIdentityResolver = new EntityIdentityResolver (_stageMock, _resolverMock, _context);

      _entityExpression = SqlStatementModelObjectMother.CreateSqlEntityDefinitionExpression (typeof (Cook), primaryKeyType: typeof (int));
      _entityConstantExpression = new SqlEntityConstantExpression (typeof (Cook), new Cook (), Expression.Constant (0));
      _entityRefMemberExpression = new SqlEntityRefMemberExpression (
          SqlStatementModelObjectMother.CreateSqlEntityDefinitionExpression (typeof (Kitchen)),
          typeof (Kitchen).GetProperty ("Cook"));
    }
    public void SetUp ()
    {
      _stageMock = MockRepository.GenerateStrictMock<IMappingResolutionStage>();
      _resolverMock = MockRepository.GenerateStrictMock<IMappingResolver>();
      _sqlTable = SqlStatementModelObjectMother.CreateSqlTable_WithResolvedTableInfo (typeof (Cook));
      _mappingResolutionContext = new MappingResolutionContext();
      _generator = new UniqueIdentifierGenerator();
      _entityIdentityResolverMock = MockRepository.GenerateStrictMock<IEntityIdentityResolver> ();
      _compoundComparisonSplitterMock = MockRepository.GenerateStrictMock<ICompoundExpressionComparisonSplitter> ();
      _namedExpressionCombinerMock = MockRepository.GenerateStrictMock<INamedExpressionCombiner>();
      _groupAggregateSimplifierMock = MockRepository.GenerateStrictMock<IGroupAggregateSimplifier>();

      _visitor = CreateVisitor (true);
    }
    public void SetUp ()
    {
      // var query = from c in Customers select null
      _mainFromClause = new MainFromClause ("c", typeof (DataContextTestClass.Customer), Expression.Constant (new DataContextTestClass.Customer[0]));
      _selectClause = new SelectClause (Expression.Constant (null, typeof (DataContextTestClass.Customer)));
      _queryModel = new QueryModel (_mainFromClause, _selectClause);

      _resolverStub = MockRepository.GenerateStub<IMappingResolver> ();
      _resolverStub
          .Stub (stub => stub.ResolveTableInfo (Arg<UnresolvedTableInfo>.Is.Anything, Arg<UniqueIdentifierGenerator>.Is.Anything))
          .Return (new ResolvedSimpleTableInfo (typeof (DataContextTestClass.Customer), "CustomerTable", "t0"));
      _resolverStub
          .Stub (stub => stub.ResolveConstantExpression ((ConstantExpression) _selectClause.Selector))
          .Return (_selectClause.Selector);
    }
    public static ResolvedJoinInfo ResolveJoinInfo (
        IJoinInfo joinInfo,
        IMappingResolver resolver,
        UniqueIdentifierGenerator generator,
        IMappingResolutionStage stage,
        IMappingResolutionContext context)
    {
      ArgumentUtility.CheckNotNull ("joinInfo", joinInfo);
      ArgumentUtility.CheckNotNull ("resolver", resolver);
      ArgumentUtility.CheckNotNull ("generator", generator);
      ArgumentUtility.CheckNotNull ("stage", stage);
      ArgumentUtility.CheckNotNull ("context", context);

      var visitor = new ResolvingJoinInfoVisitor (resolver, generator, stage, context);
      return (ResolvedJoinInfo) joinInfo.Accept (visitor);
    }
 protected ResolvingSelectExpressionVisitor (
     IMappingResolver resolver,
     IMappingResolutionStage stage,
     IMappingResolutionContext context,
     UniqueIdentifierGenerator generator, 
     IEntityIdentityResolver entityIdentityResolver,
     ICompoundExpressionComparisonSplitter comparisonSplitter,
     INamedExpressionCombiner namedExpressionCombiner,
     IGroupAggregateSimplifier groupAggregateSimplifier,
     bool resolveEntityRefMemberExpressions,
     SqlStatementBuilder sqlStatementBuilder)
     : base (
         resolver,
         stage,
         context,
         generator,
         entityIdentityResolver,
         comparisonSplitter,
         namedExpressionCombiner,
         groupAggregateSimplifier,
         resolveEntityRefMemberExpressions)
 {
   _sqlStatementBuilder = sqlStatementBuilder;
 }
 public EntityIdentityResolver (IMappingResolutionStage stage, IMappingResolver resolver, IMappingResolutionContext context)
 {
   _stage = stage;
   _resolver = resolver;
   _context = context;
 }
 public Expression ResolveReference (SqlTableBase sqlTable, IMappingResolver mappingResolver, IMappingResolutionContext context, UniqueIdentifierGenerator generator)
 {
   var selectProjection = SqlStatement.SelectProjection;
   return SubStatementReferenceResolver.ResolveSubStatementReferenceExpression (selectProjection, this, sqlTable, context);
 }
    protected ResolvingExpressionVisitor (
        IMappingResolver resolver,
        IMappingResolutionStage stage,
        IMappingResolutionContext context,
        UniqueIdentifierGenerator generator,
        IEntityIdentityResolver entityIdentityResolver,
        ICompoundExpressionComparisonSplitter compoundComparisonSplitter,
        INamedExpressionCombiner namedExpressionCombiner,
        IGroupAggregateSimplifier groupAggregateSimplifier,
        bool resolveEntityRefMemberExpressions)
    {
      ArgumentUtility.CheckNotNull ("resolver", resolver);
      ArgumentUtility.CheckNotNull ("stage", stage);
      ArgumentUtility.CheckNotNull ("context", context);
      ArgumentUtility.CheckNotNull ("generator", generator);
      ArgumentUtility.CheckNotNull ("entityIdentityResolver", entityIdentityResolver);
      ArgumentUtility.CheckNotNull ("compoundComparisonSplitter", compoundComparisonSplitter);
      ArgumentUtility.CheckNotNull ("namedExpressionCombiner", namedExpressionCombiner);
      ArgumentUtility.CheckNotNull ("groupAggregateSimplifier", groupAggregateSimplifier);
      
      _resolver = resolver;
      _stage = stage;
      _context = context;
      _generator = generator;
      _entityIdentityResolver = entityIdentityResolver;
      _compoundComparisonSplitter = compoundComparisonSplitter;
      _namedExpressionCombiner = namedExpressionCombiner;
      _groupAggregateSimplifier = groupAggregateSimplifier;

      _resolveEntityRefMemberExpressions = resolveEntityRefMemberExpressions;
    }
Exemple #18
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="mappingResolver"></param>
 public NumericalIntegrationMethod(IMappingResolver mappingResolver)
 {
     this._mappingResolver = mappingResolver;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SilkveilContainer" /> type.
        /// </summary>
        /// <param name="containerBinder">The container binder.</param>
        /// <param name="requestListeners">The request listeners.</param>
        /// <param name="downloadMappingResolver">The download mapping resolver.</param>
        /// <param name="redirectMappingResolver">The redirect mapping resolver.</param>
        /// <param name="downloadMappingProvider">The download mapping provider.</param>
        /// <param name="redirectMappingProvider">The redirect mapping provider.</param>
        /// <param name="contentSources">The content sources.</param>
        /// <param name="streamSplitter">The stream splitter.</param>
        /// <param name="httpStreamFactory">The HTTP stream factory.</param>
        public SilkveilContainer(IContainerBinder containerBinder, IEnumerable<IRequestListener> requestListeners, IMappingResolver<IDownloadMapping> downloadMappingResolver, IMappingResolver<IRedirectMapping> redirectMappingResolver, IMappingProvider<IDownloadMapping> downloadMappingProvider, IMappingProvider<IRedirectMapping> redirectMappingProvider, IEnumerable<IContentSource> contentSources, IStreamSplitter streamSplitter, IHttpStreamFactory httpStreamFactory)
        {
            Enforce.IsNotNull(containerBinder, () => containerBinder);
            Enforce.IsNotNullOrEmpty(requestListeners, () => requestListeners);
            Enforce.IsNotNull(downloadMappingResolver, () => downloadMappingResolver);
            Enforce.IsNotNull(redirectMappingResolver, () => redirectMappingResolver);
            Enforce.IsNotNull(downloadMappingProvider, () => downloadMappingProvider);
            Enforce.IsNotNull(redirectMappingProvider, () => redirectMappingProvider);
            Enforce.IsNotNullOrEmpty(contentSources, () => contentSources);
            Enforce.IsNotNull(streamSplitter, () => streamSplitter);
            Enforce.IsNotNull(httpStreamFactory, () => httpStreamFactory);

            this._requestListeners = requestListeners;
            this._downloadMappingResolver = downloadMappingResolver;
            this._redirectMappingResolver = redirectMappingResolver;
            this._downloadMappingProvider = downloadMappingProvider;
            this._redirectMappingProvider = redirectMappingProvider;
            this._contentSources = contentSources;
            this._streamSplitter = streamSplitter;
            this._httpStreamFactory = httpStreamFactory;

            containerBinder
                // Bind IIS request to all request listeners.
                .Bind(this, "HandleInternal", from r in this._requestListeners select (Action<string>)r.Handle)

                // Bind download request listener to download mapping resolver.
                .Bind<Guid>(
                    from r in this._requestListeners where r.GetType() == typeof(DownloadRequestListener) select r,
                    "ValidUriDetected", this._downloadMappingResolver.ResolveGuid)

                // Bind download request listener to download mapping resolver.
                .Bind<Guid>(
                    from r in this._requestListeners where r.GetType() == typeof(RedirectRequestListener) select r,
                    "ValidUriDetected", this._redirectMappingResolver.ResolveGuid)

                // Bind download mapping resolver to download mapping provider.
                .Bind<Guid>(this._downloadMappingResolver, "RequestMapping", this._downloadMappingProvider.ReadById)

                // Bind redirect mapping resolver to redirect mapping provider.
                .Bind<Guid>(this._redirectMappingResolver, "RequestMapping", this._redirectMappingProvider.ReadById)

                // Bind download mapping provider to download mapping resolver.
                .Bind<IDownloadMapping>(this._downloadMappingProvider, "MappingAvailable",
                                        this._downloadMappingResolver.RequestedMappingAvailable)

                // Bind redirect mapping provider to redirect mapping resolver.
                .Bind<IRedirectMapping>(this._redirectMappingProvider, "MappingAvailable",
                                        this._redirectMappingResolver.RequestedMappingAvailable)

                // Bind download mapping resolver to all content sources.
                .Bind<IDownloadMapping>(this._downloadMappingResolver, "MappingResolved",
                                m => this._contentSources.ForEach(c => c.Request(m.Uri)))

                // Bind all content sources to stream splitter.
                .Bind<Stream>(this._contentSources, "ContentAvailable", this._streamSplitter.Split)

                // Bind stream splitter to IIS response.
                .Bind<IStreamPart>(this._streamSplitter, "StreamPartAvailable", this.OnResponsePartAvailable)

                // Bind redirect mapping resolver to the HTTP stream factory.
                .Bind<IRedirectMapping>(this._redirectMappingResolver, "MappingResolved",
                                        this._httpStreamFactory.CreateRedirect)

                // Bind HTTP stream factory to itself.
                .Bind(this._httpStreamFactory, "StreamAvailable",
                      new Action<Stream>[]
                          {
                              this._httpStreamFactory.RequestStatusCode,
                              this._httpStreamFactory.RequestHeaders
                          })

                // Bind HTTP stream factory to IIS response.
                .Bind<IDictionary<string, string>>(this._httpStreamFactory, "HeadersAvailable", this.OnHeadersAvailable)
                .Bind<int>(this._httpStreamFactory, "StatusCodeAvailable", this.OnStatusCodeAvailable);
        }
Exemple #20
0
 public EntityIdentityResolver(IMappingResolutionStage stage, IMappingResolver resolver, IMappingResolutionContext context)
 {
     _stage    = stage;
     _resolver = resolver;
     _context  = context;
 }
Exemple #21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SilkveilContainer" /> type.
        /// </summary>
        /// <param name="containerBinder">The container binder.</param>
        /// <param name="requestListeners">The request listeners.</param>
        /// <param name="downloadMappingResolver">The download mapping resolver.</param>
        /// <param name="redirectMappingResolver">The redirect mapping resolver.</param>
        /// <param name="downloadMappingProvider">The download mapping provider.</param>
        /// <param name="redirectMappingProvider">The redirect mapping provider.</param>
        /// <param name="contentSources">The content sources.</param>
        /// <param name="streamSplitter">The stream splitter.</param>
        /// <param name="httpStreamFactory">The HTTP stream factory.</param>
        public SilkveilContainer(IContainerBinder containerBinder, IEnumerable <IRequestListener> requestListeners, IMappingResolver <IDownloadMapping> downloadMappingResolver, IMappingResolver <IRedirectMapping> redirectMappingResolver, IMappingProvider <IDownloadMapping> downloadMappingProvider, IMappingProvider <IRedirectMapping> redirectMappingProvider, IEnumerable <IContentSource> contentSources, IStreamSplitter streamSplitter, IHttpStreamFactory httpStreamFactory)
        {
            Enforce.IsNotNull(containerBinder, () => containerBinder);
            Enforce.IsNotNullOrEmpty(requestListeners, () => requestListeners);
            Enforce.IsNotNull(downloadMappingResolver, () => downloadMappingResolver);
            Enforce.IsNotNull(redirectMappingResolver, () => redirectMappingResolver);
            Enforce.IsNotNull(downloadMappingProvider, () => downloadMappingProvider);
            Enforce.IsNotNull(redirectMappingProvider, () => redirectMappingProvider);
            Enforce.IsNotNullOrEmpty(contentSources, () => contentSources);
            Enforce.IsNotNull(streamSplitter, () => streamSplitter);
            Enforce.IsNotNull(httpStreamFactory, () => httpStreamFactory);

            this._requestListeners        = requestListeners;
            this._downloadMappingResolver = downloadMappingResolver;
            this._redirectMappingResolver = redirectMappingResolver;
            this._downloadMappingProvider = downloadMappingProvider;
            this._redirectMappingProvider = redirectMappingProvider;
            this._contentSources          = contentSources;
            this._streamSplitter          = streamSplitter;
            this._httpStreamFactory       = httpStreamFactory;

            containerBinder
            // Bind IIS request to all request listeners.
            .Bind(this, "HandleInternal", from r in this._requestListeners select(Action <string>) r.Handle)

            // Bind download request listener to download mapping resolver.
            .Bind <Guid>(
                from r in this._requestListeners where r.GetType() == typeof(DownloadRequestListener) select r,
                "ValidUriDetected", this._downloadMappingResolver.ResolveGuid)

            // Bind download request listener to download mapping resolver.
            .Bind <Guid>(
                from r in this._requestListeners where r.GetType() == typeof(RedirectRequestListener) select r,
                "ValidUriDetected", this._redirectMappingResolver.ResolveGuid)

            // Bind download mapping resolver to download mapping provider.
            .Bind <Guid>(this._downloadMappingResolver, "RequestMapping", this._downloadMappingProvider.ReadById)

            // Bind redirect mapping resolver to redirect mapping provider.
            .Bind <Guid>(this._redirectMappingResolver, "RequestMapping", this._redirectMappingProvider.ReadById)

            // Bind download mapping provider to download mapping resolver.
            .Bind <IDownloadMapping>(this._downloadMappingProvider, "MappingAvailable",
                                     this._downloadMappingResolver.RequestedMappingAvailable)

            // Bind redirect mapping provider to redirect mapping resolver.
            .Bind <IRedirectMapping>(this._redirectMappingProvider, "MappingAvailable",
                                     this._redirectMappingResolver.RequestedMappingAvailable)

            // Bind download mapping resolver to all content sources.
            .Bind <IDownloadMapping>(this._downloadMappingResolver, "MappingResolved",
                                     m => this._contentSources.ForEach(c => c.Request(m.Uri)))

            // Bind all content sources to stream splitter.
            .Bind <Stream>(this._contentSources, "ContentAvailable", this._streamSplitter.Split)

            // Bind stream splitter to IIS response.
            .Bind <IStreamPart>(this._streamSplitter, "StreamPartAvailable", this.OnResponsePartAvailable)

            // Bind redirect mapping resolver to the HTTP stream factory.
            .Bind <IRedirectMapping>(this._redirectMappingResolver, "MappingResolved",
                                     this._httpStreamFactory.CreateRedirect)

            // Bind HTTP stream factory to itself.
            .Bind(this._httpStreamFactory, "StreamAvailable",
                  new Action <Stream>[]
            {
                this._httpStreamFactory.RequestStatusCode,
                this._httpStreamFactory.RequestHeaders
            })

            // Bind HTTP stream factory to IIS response.
            .Bind <IDictionary <string, string> >(this._httpStreamFactory, "HeadersAvailable", this.OnHeadersAvailable)
            .Bind <int>(this._httpStreamFactory, "StatusCodeAvailable", this.OnStatusCodeAvailable);
        }
 public void SetUp ()
 {
   _stageMock = MockRepository.GenerateStrictMock<IMappingResolutionStage> ();
   _resolverMock = MockRepository.GenerateMock<IMappingResolver> ();
   _mappingResolutionContext = new MappingResolutionContext ();
 }
Exemple #23
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="force"></param>
 public NewmarkBetaMethod(IForce force, IMappingResolver mappingResolver)
     : base(mappingResolver)
 {
     this._force = force;
 }
Exemple #24
0
 public MsSqlWhereClauseBuilder(IMappingResolver mappingResolver)
     : base(mappingResolver)
 {
 }
    public Expression ResolveMemberAccess (Expression resolvedSourceExpression, MemberInfo memberInfo, IMappingResolver mappingResolver, IMappingResolutionContext context)
    {
      ArgumentUtility.CheckNotNull ("resolvedSourceExpression", resolvedSourceExpression);
      ArgumentUtility.CheckNotNull ("memberInfo", memberInfo);
      ArgumentUtility.CheckNotNull ("mappingResolver", mappingResolver);
      ArgumentUtility.CheckNotNull ("context", context);

      return MemberAccessResolver.ResolveMemberAccess (resolvedSourceExpression, memberInfo, mappingResolver, this, context);
    }
 public DefaultSessionFactoryProvider(IMappingResolver mappingResolver, ICmsConfiguration configuration, ISecurityService securityService)
 {
     this.mappingResolver = mappingResolver;
     this.configuration = configuration;
     this.securityService = securityService;
 }
 public DefaultSessionFactoryProvider(IMappingResolver mappingResolver, ICmsConfiguration configuration, ISecurityService securityService)
 {
     this.mappingResolver = mappingResolver;
     this.configuration   = configuration;
     this.securityService = securityService;
 }