Represents a column in the SQL result returned by a LINQ query. The in-memory projections generated by re-linq use this as a parameter to the methods of IDatabaseResultRow when they need to retrieve a value from a result row. Each column is identified both by its ColumnName and its Position. The implementer of IDatabaseResultRow is free to choose which identifier to use when retrieving a value from a result row.
コード例 #1
0
        public T GetValue <T> (Remotion.Linq.SqlBackend.SqlGeneration.ColumnID id)
        {
            if (_dataReader.IsDBNull(id.Position))
            {
                return(default(T));
            }

            return((T)_dataReader.GetValue(id.Position));
        }
コード例 #2
0
    public void GetEntity_WithSingleColumn ()
    {
      var columnID = new ColumnID ("Name", 0);
      _readerMock
          .Expect (mock => mock.GetValue (columnID.Position))
          .Return ("Peter");

      var scalarRowWrapper = new ScalarRowWrapper (_readerMock);

      var value = scalarRowWrapper.GetEntity<string> (columnID);
      Assert.That ("Peter", Is.EqualTo (value));
    }
コード例 #3
0
    public void GetValue_ShouldReturnValue ()
    {
      var columnID = new ColumnID ("Name", 0);
      var scalarRowWrapper = new ScalarRowWrapper (_readerMock);
      _readerMock
          .Expect (mock => mock.GetValue (columnID.Position))
          .Return ("Peter");

      var value = scalarRowWrapper.GetValue<string> (columnID);

      _readerMock.VerifyAllExpectations();
      Assert.That ("Peter", Is.EqualTo (value));
    }
コード例 #4
0
    public void SimpleGetValue_ShouldReturnValue ()
    {
      var columnID = new ColumnID ("Name", 1);
      var rowWrapper = new RowWrapper (_readerMock, _reverseMappingResolverMock);
      _readerMock
          .Expect (mock => mock.GetValue (columnID.Position))
          .Return ("Peter");

      var value = rowWrapper.GetValue<string> (columnID);

      _readerMock.VerifyAllExpectations();
      Assert.That ("Peter", Is.EqualTo (value));
    }