Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LINQ creates a wrong _type #38

Open
ice19942335 opened this issue Aug 9, 2021 · 1 comment
Open

LINQ creates a wrong _type #38

ice19942335 opened this issue Aug 9, 2021 · 1 comment

Comments

@ice19942335
Copy link

Why the Sanity Linq creates the wrong _type???

internal class CalendarEvent
    {
        [JsonProperty("_type")]
        internal string DocumentType => "schedule.metadata";

        [JsonProperty("_id")]
        internal string Id { get; set; }

        [JsonProperty("_lang")]
        internal string Locale { get; set; }

        internal Guid DocumentId { get; set; }

        internal DateTimeOffset? DateTime { get; set; }
    }
public async Task<CalendarEventList> GetDocumentsToBePublishedIds()
        {
            SanityDocumentSet<CalendarEvent> documentSet = SanityDataContext.DocumentSet<CalendarEvent>();

            var test = await documentSet
                .Where(calendarEvent => calendarEvent.DateTime >= DateTime.Today)
                .ToListAsync();

            var groq = documentSet
                .Where(calendarEvent => calendarEvent.DateTime >= DateTime.Today)
                .GetSanityQuery();

            return null;
        }

Screenshot 2021-08-09 112359
Screenshot 2021-08-09 112327

@ice19942335
Copy link
Author

If I will pass in .Where(x => x...) instead of .Where(calendarEvent => calendarEvent ...) then it works, but, isn't it a bug??? As I spend a lot of time to get why it doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant