I'm not sure if this is a bug or if it's not possible.
Code: Select all
CREATE TABLE `RealGamesFeedData`.`ProductHistoryLogs` (
`ProductHistoryLogId` char(36) NOT NULL,
`ProductId` char(36) NOT NULL,
`Action` enum('Updated','Created','Deleted') NOT NULL,
`Entry` datetime NOT NULL,
PRIMARY KEY (`ProductHistoryLogId`),
KEY `IN_ProductHistoryLogs_Entry` (`Entry`),
KEY `IN_ProductHistoryLogs_Action` (`Action`),
KEY `FK_ProductHistoryLogs_Product` (`ProductId`),
CONSTRAINT `FK_ProductHistoryLogs_Product` FOREIGN KEY (`ProductId`) REFERENCES `Products` (`ProductId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
After playing around I found that this works
Code: Select all
context.ProductHistoryLogSet.Where(p => p.Products.ProductId == "d27248b8-604a-bd93-0ed6-81c3033da219").OrderByDescending(log => log.Entry).First()
Code: Select all
context.ProductHistoryLogSet.OrderByDescending(log => log.Entry).First(p => p.Products.ProductId == "d27248b8-604a-bd93-0ed6-81c3033da219")
Should these both not return the same result?
Thanks
Pleb.