Linq ile rastgele kayit cekmek icin yapmaniz gereken cok basit.
[Function(Name="NEWID", IsComposable=true)]
public Guid Random()
{
return Guid.NewGuid();
}
....
ctx.Log = Console.Out;
var query = from x in ctx.Suppliers
orderby ctx.Random()
select x;
var results = query.ToArray();
....
Olusan Select cumlesi asagidaki gibi olacaktir.
SELECT [t0].[SupplierID], [t0].[CompanyName], [t0].[ContactName],
[t0].[ContactTitle], [t0].[Address], [t0].[City], [t0].[Region],
[t0].[PostalCode], [t0].[Country], [t0].[Phone], [t0].[Fax], [t0].[HomePage]
FROM [dbo].[Suppliers] AS [t0]
ORDER BY NEWID()