views:

46

answers:

2

Hi,

I am looking for architecture like as follows:

Database --> DataSet --> DataContext(Linq)/ ORM Entity --> GUI Application

I want to fetch data from database and keep into DataSet so if database id disconnect my

application doesn't affect.

But DataSet is not supporting Object-Relational-Mapping (ORM) Model. I am interested in

ORM because I want to take the advantages of LINQ.

and finally on My GUI i want to access Entity Classes.

Please Explain this by taking example like

  1. College (Database Table) College_id (Primary Key) College_name

  2. Student (Database Table) Student_id (Primary Key) Student_name College_id (Foreign Key) Student_mark

Design a GUI in One Drop Down List which contains College List and on College Selection

it displays Student List (Student Id,name,mark) in GridView.

Client Code i need something like this...

College cl = (College) DropDownList1.SelectedItem; List student_list = cl.students; GridView1.DataSource = student_list; GridView.DataBind();

Thanks

A: 

I think a better approach to that problem would be to use a local database such as SQL Server Compact, which you can synchronize with the main DB...

Thomas Levesque
A: 

You CAN use LINQ on DataSets. Just make sure you have targeted .NET 3.5 and add "System.Data.DataSetExtensions" to your list of references.

Quote from MSDN:

To target the .NET Framework 3.5 In Visual Studio 2008, create a new Visual Basic or C# project. Alternatively, you can open a Visual Basic or C# project that was created in Visual Studio 2005 and follow the prompts to convert it to a Visual Studio 2008 project.

For a C# project, click the Project menu, and then click Properties.

In the Application property page, select .NET Framework 3.5 in the Target Framework drop-down list.

For a Visual Basic project, click the Project menu, and then click Properties.

In the Compile property page, click Advanced Compile Options and then select .NET Framework 3.5 in the Target Framework (all configurations) drop-down list.

On the Project menu, click Add Reference, click the .NET tab, scroll down to System.Core, click it, and then click OK.

Add a using directive or imported namespace for System.Linq to your source code file or project.

For more information, see using Directive (C# Reference) or How to: Add or Remove Imported Namespaces (Visual Basic).

To enable LINQ to DataSet functionality If necessary, follow the steps earlier in this topic to add a reference to System.Core.dll and a using directive or imported namespace for System.Linq.

In C# or Visual Basic, click the Project menu, and then click Add Reference.

In the Add Reference dialog box, click the .NET tab if it is not on top. Scroll down to System.Data and System.Data.DataSetExtensions and click on them. Click the OK button.

Add a using directive or imported namespace for System.Data to your source code file or project. For more information, see using Directive (C# Reference) or How to: Add or Remove Imported Namespaces (Visual Basic).

Add a reference to System.Data.DataSetExtensions.dll for LINQ to Dataset functionality. Add a reference to System.Data.dll if it does not already exist.

Optionally, add a using directive or imported namespace for System.Data.Common or System.Data.SqlClient, depending on how you connect to the database.

Iravanchi