lundi 7 septembre 2015

Linq to EF guid in where clause always returns null

I've tried many different ways and the "topic" is always null from the LINQ statement. Is there something special that has to be done when comparing GUIDs with SQLite as the data source?

    public TopicModel GetTopicModel(Guid id)
    {
        TopicModel topicModel = null;
        using (var context = new onenessEntities())
        {
            var topic = context.Topics.FirstOrDefault(x => x.Id.Equals(id));

            if (topic != null)
            {
                topicModel = new TopicModel
                {
                    Id = topic.Id,
                    Description = topic.Description,
                    Title = topic.Title
                };
            }
        }

        return topicModel;
    }

Aucun commentaire:

Enregistrer un commentaire