CLR存储过程中如何使用实体框架? [英] How do I use Entity Framework in a CLR stored procedure?

查看:128
本文介绍了CLR存储过程中如何使用实体框架?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待着将所有的逻辑(被实现为操纵实体框架4个对象)到服务器端。它看起来会是简单的(感谢应用结构)和有益的(因为我只有一个oldy台笔记本电脑作为客户端和一个艰难的服务器,运行SQL Server 2008和建设的逻辑可以只引入更多的延迟​​一个单独的服务如果与该数据库内做)。

I am looking forward to move all the logic (which is implemented as manipulating Entity Framework 4 objects) to a server side. It looks going to be simple (thanks to the application structure) and beneficial (as all I have is one oldy laptop as a client and one tough server which runs SQL Server 2008, and building a separate service for the logic can just introduce more latency if compared to doing it inside the database).

那么,如何正确地使用实体框架的一个CLR存储过程中,并使其通过一个主机服务器提供SqlContext?

So how do I correctly use Entities Framework inside a CLR stored procedure and make it using a host-server-provided SqlContext?

突然间我找不到在Web任何的例子。看起来stragne,没有还没有吃饭这一点。这是否意味着任务是荒谬的,我绝对不应该这样做?这不会是非常方便的使用T-SQL和访问表,而不是直接EF类,因为我的模型大量使用继承,并且具有很多非常简单的表格很复杂的表每式结构。

Suddenly I couldn't find any examples in the Web. Looks stragne that none has yet dine this. Does it mean that the task is ridiculous and I definitely should not do that? It won't be very convenient to use T-SQL and access tables directly instead of EF classes because my model makes heavy use of inheritance and has a very complex table-per-type structure of lots of very simple tables.

推荐答案

没有,你不能。 Visual Studio中甚至不会让你添加的文件或项目类型。 (这太糟糕了,我想这样做也处理一些非常复杂的逻辑。)

No, you can't. Visual Studio wouldn't even let you add the file or project type. (That's too bad, I wanted to do that also to process some really complex logic.)

这篇关于CLR存储过程中如何使用实体框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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