Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-637

Fluent Lambda Expressions Don't Resolve Interfaces

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.8
    • Affects Version/s: 1.6.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      All

      This was actually reported by MARCOSB on GitHub to me in the comments for a pull request I made here: https://github.com/mongodb/mongo-csharp-driver/commit/5a62ca86fba984803e445a1d182bc125a56c7714

      public interface IMyInterface
      {
      string SomeField

      { get; set; }
      }

      public class MyClass : IMyInterface
      {
      [BsonElement("bla")]
      public string SomeField { get; set; }

      }

      public class HelperClass<T>
      where T : IMyInterface
      {
      public void DoSomething()

      { var classMapForT = new BsonClassMap<T>(); classMapForT.AutoMap(); // This will throw an exception - but seems like a reasonable use-case, right? classMapForT.MapMember(t => t.SomeField); }

      }

      I believe it is a regression; I will issue a fix for this.

            Assignee:
            craig.wilson@mongodb.com Craig Wilson
            Reporter:
            optimiz3 Alexander Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: