MappingResolutionContext holds context information required during mapping resolution stage.
Inheritance: IMappingResolutionContext
 public void SetUp ()
 {
   _context = new MappingResolutionContext();
   _entityExpression = SqlStatementModelObjectMother.CreateSqlEntityDefinitionExpression (typeof (Cook), null, "c");
   _groupingSelectExpression = new SqlGroupingSelectExpression (Expression.Constant ("key"), Expression.Constant ("element"));
   _sqlTable = new SqlTable (new ResolvedSimpleTableInfo (typeof (Cook), "CookTable", "c"), JoinSemantics.Inner);
 }
 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 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 ResolveReference ()
    {
      var sqlTable = new SqlTable (_tableInfo, JoinSemantics.Inner);
      
      var generator = new UniqueIdentifierGenerator ();
      var resolverMock = MockRepository.GenerateStrictMock<IMappingResolver> ();
      var mappingResolutionContext = new MappingResolutionContext ();

      resolverMock.Replay ();

      var result = _tableInfo.ResolveReference (sqlTable, resolverMock, mappingResolutionContext, generator);

      Assert.That (result, Is.TypeOf (typeof (SqlColumnDefinitionExpression)));
      Assert.That (((SqlColumnDefinitionExpression) result).ColumnName, Is.EqualTo ("test"));
      Assert.That (((SqlColumnDefinitionExpression) result).OwningTableAlias, Is.EqualTo (_tableInfo.TableAlias));
      Assert.That (result.Type, Is.EqualTo (typeof (int)));
    }
    public void ResolveReference ()
    {
      var sqlTable = new SqlTable (_tableInfo, JoinSemantics.Inner);
      var fakeResult = SqlStatementModelObjectMother.CreateSqlEntityDefinitionExpression (typeof (Cook));

      var generator = new UniqueIdentifierGenerator();
      var resolverMock = MockRepository.GenerateStrictMock<IMappingResolver>();
      var mappingResolutionContext = new MappingResolutionContext();

      resolverMock
          .Expect (mock => mock.ResolveSimpleTableInfo (_tableInfo, generator))
          .Return (fakeResult);
      resolverMock.Replay ();

      var result = _tableInfo.ResolveReference (sqlTable, resolverMock, mappingResolutionContext, generator);

      resolverMock.VerifyAllExpectations ();
      Assert.That (result, Is.SameAs (fakeResult));
      Assert.That (mappingResolutionContext.GetSqlTableForEntityExpression ((SqlEntityExpression) result), Is.SameAs (sqlTable));
    }
    public void SetUp ()
    {
      _dataInfo = new StreamedScalarValueInfo (typeof (int));

      _resolvedElementExpressionReference = new SqlColumnDefinitionExpression (typeof (string), "q0", "element", false);
      _resolvedSelectProjection = new NamedExpression (
          null, 
          new AggregationExpression (typeof (int), _resolvedElementExpressionReference, AggregationModifier.Min));

      _associatedGroupingSelectExpression = new SqlGroupingSelectExpression (
          new NamedExpression ("key", Expression.Constant ("k")),
          new NamedExpression ("element", Expression.Constant ("e")));

      _resolvedJoinedGroupingSubStatement = SqlStatementModelObjectMother.CreateSqlStatement (_associatedGroupingSelectExpression);
      _resolvedJoinedGroupingTable = new SqlTable (
          new ResolvedJoinedGroupingTableInfo (
              "q1",
              _resolvedJoinedGroupingSubStatement,
              _associatedGroupingSelectExpression,
              "q0"), JoinSemantics.Inner);

      _simplifiableResolvedSqlStatement = new SqlStatement (
          _dataInfo,
          _resolvedSelectProjection,
          new[] { _resolvedJoinedGroupingTable },
          null,
          null,
          new Ordering[0],
          null,
          false,
          Expression.Constant (0),
          Expression.Constant (0));
      _simplifiableUnresolvedProjection = new AggregationExpression (
          typeof (int),
          new SqlTableReferenceExpression (_resolvedJoinedGroupingTable),
          AggregationModifier.Count);

      _stageMock = MockRepository.GenerateStrictMock<IMappingResolutionStage> ();
      _context = new MappingResolutionContext();

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