Linq To SQL and Service (plain dll) : need comment(s)

Oct 22, 2008 at 3:52 AM
Using sculpture and design it like this:
  • Data Source Layer = SQL Server
  • Data Access Layer = Linq To Sql
  • Service Layer = Service Library (.dll)
Would you think is is a good approach?
And how do I make my DataContracts bind-able on the DataSource propertiy of the GridView, Datagrid .. etc.

Thanks,
Chris






Coordinator
Oct 23, 2008 at 10:49 AM

Hi Chris

Sure your design is good if you do not need distributed system or you application will run from one machine there is no need for the web services.
The only concern about Linq To Sql is that Linq To Sql run under SQL Server Only, if that satisfy your requirements then go ahead!

About binding data contracts to grids, It is recommended to use data source as:

<asp:ObjectDataSource ID="CategoriesDataSource" runat="server"
        SelectMethod="GetAll" TypeName="Services.CategoriesService">
</asp:ObjectDataSource>


And may be also use "GetAll" as data source directly as:

ICategoriesService cs = new CategoriesService();
GridView1.DataSource = cs.GetAll();
DataBind();


Negm