Uploaded image for project: 're-motion'
  1. re-motion
  2. RM-3631

Provide transformations that add member meta-info to common tuple-like constructor calls

    Details

      Description

      Consider the following example (from http://groups.google.com/group/nhusers/browse_thread/thread/7289619c4eceaf2b):

        from u in db.Users 
        select new KeyValuePair<string, DateTime>(u.Name, u.RegisteredAt) into nameRegistered
        order by nameRegistered.Value
      

      The provider cannot know that u.Name goes into nameRegistered.Value. To allow for that, add a custom transformation that adds the metadata to the ctor call:

        NewExpression (
          ctorof (KeyValuePair<TK,TV>(TK,TV)), 
          new[] { keyExpr, valueExpr }, 
          new[] { memberof (KeyValuePair<TK,TV>.Key), memberof (KeyValuePair<TK,TV>.Value) })
      

      Transformations such as the one described above are added a set of classes: KeyValuePairNewExpressionTransformer, and DictionaryEntryTransformer, and TupleNewExpressionTransformer, The transformations, which are enabled by default, add the MemberInfo metadata to NewExpressions for KeyValuePair<TKey, TValue>, DictionaryEntry, and the .NET Tuple types.

      To implement such a transformation for custom types, derive from MemberAddingNewExpressionTransformerBase.

      For LINQ providers customizing the expression tree preprocessing steps applied by the re-linq front-end, add instances of the transformer classes to the ExpressionTransformationStep.

        Attachments

          Issue Links

          There are no Sub-Tasks for this issue.

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                fabian.schmied Fabian Schmied
                Reporter:
                stefan.wenig Stefan Wenig
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 2 hours Original Estimate - 2 hours
                  2h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 30 minutes
                  2h 30m