这是我所有课程的共同结构:
public class User
{
public int ID { get;set; }
public string User_name { get; set; }
public string Pass_word { get; set; }
public string UserTypeCode { get; set; }
public int SaveOrUpdate()
{
int id = -1;
if (this._ID <=0)
{
id = this.Save();
}
else
{
bool success = this.Update();
if(success)
{
id = this._ID;
}
else
{
throw new Exception("Update failed!");
}
}
return id;
}
private int Save() { }
private bool Update() { }
public static User Get(int id) { }
public static List<User> Get() { }
public bool Delete() { }
}
我在winforms中顺利使用了这些类。
但是在使用 ASP.NET 时,当我尝试为 GridView 配置对象数据源时,我在Data Source Configuration Wizard
. 即他们没有出现。所以我的方法变得毫无用处。
我无法改变我所有课程的一般结构。我还为他们编写了一个代码生成器。我必须使用ObjectDataSources
.
我的第一个问题是,他们为什么不出现?
而且,我应该怎么做才能让他们出现?