断开连接的DataContext [英] Disconnected DataContext

查看:112
本文介绍了断开连接的DataContext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在寻找如下的体系结构:

数据库->数据集-> DataContext(Linq)/ORM实体-> GUI应用程序

我想从数据库中获取数据并保存到DataSet中,所以如果数据库ID断开连接,我的应用程序不会受到影响.

但是DataSet不支持对象关系映射(ORM)模型.我对ORM感兴趣,因为我想利用LINQ的优势.

最后在我的GUI上,我想访问实体类.

请以类似
的示例来说明
1.大学(数据库表)
College_id(主键)
College_name

2.学生(数据库表)
Student_id(主键)
Student_name
College_id(外键)
Student_mark

在一个包含大学列表的下拉列表中设计一个GUI,然后在大学选择"中在GridView中显示学生列表(学生ID,姓名,标记).

谢谢

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.

Thanks

推荐答案

写道:​​

我想从数据库中获取数据并保存到DataSet,因此,如果数据库ID断开连接,我的应用程序不会受到影响.

I want to fetch data from database and keep into DataSet so if database id disconnect my application doesn''t affect.



所有数据集都无法正常工作.



ALL datasets work thart way.

写道:​​

我对ORM感兴趣,因为我想利用LINQ的优势.

I am interested in ORM because I want to take the advantages of LINQ.



LINQ使用SQL数据.您唯一的问题是,在需要时对数据进行迭代,这可能意味着它稍后会向数据库请求数据,这会杀死A点.



LINQ works with SQL data. Your only issue is that it iterates over the data when it''s asked for, which may mean it requests it from the DB later, which kills point A.

写道:​​

1.大学(数据库表)
College_id(主键)
College_name

2.学生(数据库表)
Student_id(主键)
Student_name
College_id(外键)
Student_mark

在一个包含大学列表的下拉列表中设计一个GUI,然后在大学选择"中在GridView中显示学生列表(学生ID,姓名,标记).

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.



啊-这是一种令人费解的方法,试图让我们为您做功课吗?忘掉它.做你自己的工作.另外,假设您的老师知道如何使用Google,并且在网络上逐字发布时可以找到他的问题.因此,如果我给您代码,并将其传递给您,则您肯定会失败.如果您的老师有可能通过您的用户名告诉您您是谁,除非您去找他们,告诉他们您做了什么,然后向他们寻求帮助,否则您可能仍然会失败.



Ah - this is a convoluted way to try to get us to do your homework for you ? Forget about it. Do your own work. Also, assume your teacher knows how to use google and can find his questions when posted verbatim on the web. So, if I gave you code, and you passed it in, you would fail for sure. If there''s any chance your teacher can tell who you are from your user id, you will still probably fail, unless you go to them, tell them what you did, and ask THEM for help.


这篇关于断开连接的DataContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆