public static object SelectAnyInfo()
{
DataAccessContext context = new DataAccessContext();
var query = from c in context.VideoNetServers
from cc in context.Areas
from ver in context.VersionItems
where c.Areas.AreaID == cc.AreaID &&
c.VideoNetServerRowID == ver.ResourceRowID &&
ver.ResourceTableName.Contains("VIDEONETSERVERS") &&
((ver.VersionTo == int.MaxValue) || (ver.VersionTo == 0 && ver.Action != "删除"))
orderby c.VideoNetServerID
select new
{
c.VideoNetServerRowID,
c.VedeoNetServerName,
c.VedeoNetServerCode,
c.IPAddress,
cc.AreaName
};
return query;
}
public static List<Plant> GetData
{
get{
var ds = DataAccess.VideoNetServers.SelectAnyInfo();
List<Plant> data = new List<Plant>();
foreach (var obj in ds){
//这个里面无法遍历,Foreach无法定义Var obj
//麻烦高手看看
}
return data;
}
--------------------解决方法------------------
{
c.VideoNetServerRowID,
c.VedeoNetServerName,
c.VedeoNetServerCode,
c.IPAddress,
cc.AreaName
};
public static List<MyClass> SelectAnyInfo()
{
return query.ToList<MyClass>();