Pri*_*tel 6 c# asp.net linq-to-sql
我们正在开发一个项目,ASP.NET/C#
其中不是一个非常大的项目,而是一个相当大的项目.目前我们开发了几页.我现在正在谈论单页的观点.到目前为止,每个页面都遵循这种方法.
在我的页面背后的代码中,我们Linq To SQL
直接使用查询.该insert operation
做,queries
以填补dropdownlists
和其他database
相关操作在自己后面的代码中使用.
我们使用函数.其他页面也是如此.
我的问题是我应该将它们包含在class
文件中,然后创建objects
并调用适当的方法来完成我的工作吗?
如果是,我们应该创建单个class
还是每页创建一个类.这叫做创造吗Data Access Layer
?
任何人都可以帮我建议一个正确的方法吗?
这种方法是一种很好的编程习惯吗?
这是我们在后面的代码中使用的一个简单函数
public void AccountTypeFill()
{
//Get the types of Account ie Entity and individual
var acc = from type in dt.mem_types
select type.CustCategory;
if (acc != null)
{
NewCustomerddlAccountType.DataSource = acc.Distinct().ToList();
NewCustomerddlAccountType.DataBind();
}
}
Run Code Online (Sandbox Code Playgroud)
任何人都可以指出一个引用此查询的简单示例吗?
我希望我的问题有道理.欢迎任何建议.
归档时间: |
|
查看次数: |
1010 次 |
最近记录: |