Skip to content

Linq v Lambda #72

@DarthStem

Description

@DarthStem

I'm seeing unexpected behavior when querying with LINQ versus a lambda expression.

From some test code...

var fromLambda = context.Citys.FirstOrDefault(x => x.Name == cityName && x.Country.Name == countryName);
var fromLinq = (from x in context.Citys
                            where x.Name == cityName
                            where x.Country.Name == countryName
                            select x).FirstOrDefault();

Assert.IsNotNull(fromLinq);
Assert.IsNotNull(fromLambda);

fromLambda is always null but fromLinq is not null. My expectation was that they would both return the same city instance.

As background, I'm actually using a fork off of the alien-mcl/RomanticWeb fork which addressed Bug #69.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions