【发布时间】:2013-10-01 21:15:45
【问题描述】:
public static CustomizeCourseCompletionWithModuleList GetCustomizeCourseCompletionWithModuleList()
{
var cmd = new StoredProcedure
{
CommandText = "CustomizeCourseCompletionWithModuleSelectById",
CommandType = System.Data.CommandType.StoredProcedure
};
cmd.Parameters.Add("@ID", DBNull.Value);
return DataPortal.Fetch<CustomizeCourseCompletionWithModuleList>(cmd);
}
最后我想返回DataTable而不是返回DataPortal,我该怎么做呢?
CustomizeCourseCompletionWwithModuleList 类:
public class CustomizeCourseCompletionWithModuleList : BusinessListBase<CustomizeCourseCompletionWithModule>
{
#region Business Methods
public CustomizeCourseCompletionWithModule GetItem(int childId)
{
return this.FirstOrDefault(child => child.Id == childId);
}
public override void Remove(int childId)
{
foreach (var child in this.Where(child => child.Id == childId))
{
RemoveChild(child);
break;
}
}
public bool Contains(int childId)
{
return this.Any(child => child.Id == childId);
}
public bool ContainsDeleted(int childId)
{
return DeletedList.Any(child => child.Id == childId && child.IsDeleted);
}
#endregion
存储过程:
public class StoredProcedure : ICloneable
{
private Parameters _parameters = new Parameters();
private string _procName;
public StoredProcedure(string name)
{
_procName = name;
CommandType = System.Data.CommandType.StoredProcedure;
}
public StoredProcedure()
{
CommandType = System.Data.CommandType.StoredProcedure;
}
[DataMember]
public String CommandText
{
get { return _procName; }
set { _procName = value; }
}
[DataMember]
public System.Data.CommandType CommandType { get; set; }
[DataMember]
public string Name
{
get { return _procName; }
set { _procName = value; }
}
[DataMember]
public Parameters Parameters
{
get { return _parameters; }
set { _parameters = value; }
}
#region ICloneable Members
object ICloneable.Clone()
{
return GetClone();
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual object GetClone()
{
return ObjectCloner.Clone(this);
}
#endregion
}
如果您需要任何其他信息,请询问,以便您给我一个正确的答案。 提前致谢。
【问题讨论】:
-
这返回了一个
CustomizeCourseCompletionWithModuleList你到底想做什么? -
通过返回DataPortal,它会经过60个文件,因此我可以获得全部信息,因为不需要服务,因为它可以在本地完成,我需要删除与服务相关的DataPortal并使其返回我的业务对象或数据表,以便我可以对其进行排序并轻松操作。由于分页,我也需要它,我不需要在调用报告时加载所有页面,而只需要加载所选页面上的那些记录。考虑到我的英语不好,我希望我能充分解释我的想法。
标签: c# asp.net .net visual-studio-2010 visual-studio