Linq语境 [英] Linq context

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

问题描述


我正在使用EF上下文创建实体框架对象并将其保存到数据库中。现在我试图使用LinqToSql datacontext来获取该对象,但是无法找到它正在抛出的对象"Sequence不包含任何元素"。异常,但能够
来查找具有EF上下文的对象。如何使用LinqToSql datacontext找到创建EF的对象。 datacontext是否依赖于数据库用户登录设置?

I am creating the entity framework object using EF context and saving that into database. Now I am trying to get that object using LinqToSql datacontext, but not able to find the object it is throwing "Sequence contains no elements" exception, but was able to find the object with EF context. How to find the object created EF with LinqToSql datacontext. Is the datacontext depend on database user login settings?

推荐答案

您是否可以检查数据库以查看是否您要查询的数据是否在表格中?是
这是一个本地数据库,位于您的项目中还是位于服务器上的数据库?

Can you check the database to see if the data you are quering is actualy in the table?
Is this a local database, located in your project or is it a database located on the server?

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

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