Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-19260

.NET: Thin 3.0: Support nested MemberInit projections in LINQ

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • platforms

    Description

      Support nested member init projections:

       

      [Test]
      public void TestSelectMemberInitSupportsFields1()
      {
      	var res = PocoView.AsQueryable()
      		.Where(x => x.Key == 2)
      		.Select(x => new MyClass1
      		{
      			Key = x.Key,
      			Class2Prop = new MyClass2
      			{
      				Value = x.Val
      			}
      		})
      		.ToArray();
      
      	Assert.AreEqual(1, res.Length);
      	var resRow = res[0];
      }
      
      private class MyClass1
      {
      	public long Key { get; set; }
      
      	public MyClass2 Class2Prop { get; set; } = null!;
      }
      
      private class MyClass2
      {
      	public string? Value { get; set; }
      }
      

      Also check possibility to combine with anonymous types.

      Attachments

        Issue Links

          Activity

            People

              gurustron Sergey Stronchinskiy
              gurustron Sergey Stronchinskiy
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: