using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.Core.Objects.DataClasses;
namespace Bowin.Common.Linq.Entity
{
public static class SqlFunctionEx
{
///
/// 在linq to entity中使用SqlServer.NEWID函数
///
[EdmFunction("SqlServer", "NEWID")]
public static Guid NewId()
{
return Guid.NewGuid();
}
///
/// 随机排序扩展方法
///
///
///
///
public static IQueryable OrderByNewId(this IQueryable source)
{
return source.OrderBy(d => NewId());
}
}
}