public override string CreateRandomOrderBySql(DataEntityMapping mapping) { Random rnd = new Random(unchecked ((int)DateTime.Now.Ticks)); int intRandomNumber = rnd.Next() * -1; string field = ""; foreach (DataFieldMapping df in mapping.GetFieldMappings()) { if (df.ObjectType == typeof(int)) { field = CreateDataFieldSql(df.Name); break; } } if (string.IsNullOrEmpty(field)) { foreach (DataFieldMapping df in mapping.GetFieldMappings()) { if (df.ObjectType == typeof(string)) { field = string.Format("len({0})", CreateDataFieldSql(df.Name)); break; } } } if (string.IsNullOrEmpty(field)) { throw new LightDataException(RE.TypfOfDataFieldIsNotString); } return(string.Format("rnd({0}*{1})", intRandomNumber, field)); }