首先用ef4.1代码定义标量函数? [英] define scalar function with ef4.1 code first?

查看:109
本文介绍了首先用ef4.1代码定义标量函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为distance的函数,我将在标量值函数中定义它,以便在linq
之间调用它,如果EF4.1代码首先执行该操作?

i have a function called distancebetween i wnat to define it in scalar valued function to call it by linq if there is away to do that by EF4.1 code first ?

推荐答案

不。代码首先被设计为代码第一=你将创建一个代码,它将创建一个没有数据库逻辑的数据库(没有视图,存储过程,触发器或函数)。因为它完全缺少映射数据库逻辑(如函数和存储过程)的功能。如果你想在LINQ中使用它,你必须放弃代码优先/流畅的API,并开始使用EDMX,这在哪里是支持的。

No. Code first was designed as "code first" = you will create a code and it will create a database where no database logic exists (no views, stored procedures, triggers or functions). Because of that it is completely missing features for mapping database logic like functions and stored procedures. If you want to use it in LINQ you must abandon code-first / fluent-API and start tu use EDMX where this is supported.

这篇关于首先用ef4.1代码定义标量函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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