digging around subsonic, i came across this
挖掘亚音速,我遇到了这个
good article but have some ?'s
好文章,但有一些?
now i want the option to return either a IList or Dataset, would I create an abstarct factory for this, if so can I have one generic method which would take in either IList or Dataset as a ref parameter and populate the passed in object?
现在我想要选择返回IList或Dataset,我是否会为此创建一个abstarct工厂,如果可以,我可以使用一个通用方法将IList或Dataset作为ref参数并填充传入的对象?
is it a good practice to declare static classes in the business layer which talks to my data layer so that in my UI where i have a gridviewcontrol i can do this
在业务层中声明静态类是一个很好的做法,它与我的数据层对话,以便在我的UI中我有一个gridviewcontrol,我可以这样做
mybusinesslayer.getdata(ref myDataset) //as mybusinesslayer is static
mybusinesslayer.getdata(ref myDataset)//因为mybusinesslayer是静态的
mygridviewcontrol.datasource = mydataset....
mygridviewcontrol.datasource = mydataset ....
1 个解决方案
#1
3
What are you planning to do with the Datasets that you cannot do with the ILists? IMHO, you'll want to be strongly typed as much as possible.
您打算如何处理无法使用IList的数据集?恕我直言,你会希望尽可能强力打字。
On my team, we connect our middle tier to ObjectDataSources and then all of our GridViews, ListViews, etc... use them to fetch data:
在我的团队中,我们将中间层连接到ObjectDataSources,然后连接所有GridViews,ListViews等...使用它们来获取数据:
Business Layer / Middle Tier
业务层/中间层
namespace Project
{
public class BusinessLayer
{
public IList<Product> GetProducts()
{
return new Select().From( Products.Schema ).Where( Products.Columns.Status ).IsEqualTo( true ).ExecuteTypedList<Product>();
}
}
}
On Page
<asp:ObjectDataSource id="odsProducts" runat="server" TypeName="Project.BusinessLayer" SelectMethod="GetProducts()"></asp:ObjectDataSource>
Then from there, you can connect any of your data-view controls (Gridview, Listview, etc...) to the data source. It's very clean and requires no code in the code-behind.
然后,从那里,您可以将任何数据视图控件(Gridview,Listview等)连接到数据源。它非常干净,代码隐藏中不需要代码。
I also came across that article by Rob that you posted and have found it helpful in trying to figure out how to write de-coupled apps with SubSonic.
我还发现了Rob发布的那篇文章,并发现它有助于弄清楚如何用SubSonic编写解耦应用程序。
#1
3
What are you planning to do with the Datasets that you cannot do with the ILists? IMHO, you'll want to be strongly typed as much as possible.
您打算如何处理无法使用IList的数据集?恕我直言,你会希望尽可能强力打字。
On my team, we connect our middle tier to ObjectDataSources and then all of our GridViews, ListViews, etc... use them to fetch data:
在我的团队中,我们将中间层连接到ObjectDataSources,然后连接所有GridViews,ListViews等...使用它们来获取数据:
Business Layer / Middle Tier
业务层/中间层
namespace Project
{
public class BusinessLayer
{
public IList<Product> GetProducts()
{
return new Select().From( Products.Schema ).Where( Products.Columns.Status ).IsEqualTo( true ).ExecuteTypedList<Product>();
}
}
}
On Page
<asp:ObjectDataSource id="odsProducts" runat="server" TypeName="Project.BusinessLayer" SelectMethod="GetProducts()"></asp:ObjectDataSource>
Then from there, you can connect any of your data-view controls (Gridview, Listview, etc...) to the data source. It's very clean and requires no code in the code-behind.
然后,从那里,您可以将任何数据视图控件(Gridview,Listview等)连接到数据源。它非常干净,代码隐藏中不需要代码。
I also came across that article by Rob that you posted and have found it helpful in trying to figure out how to write de-coupled apps with SubSonic.
我还发现了Rob发布的那篇文章,并发现它有助于弄清楚如何用SubSonic编写解耦应用程序。