问题标签 [telerik-open-access]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
271 浏览

asp.net - 从 Telerik 开放访问 ORM 查询继承类时出错

我在我的 ASP.net C# Web 应用程序中使用最新版本的Telerik Open Access ORM 。在我的EntitiesModel1.rlinq中,我从数据库映射了一个名为“ Customer ”的表。然后我创建了一个名为“ SubCustomer ”的域类,并在其中添加了一个名为“ SubName : String ”的新属性字段。然后从域类中删除默认属性。然后我为Customer-SubCustomer类应用了继承。所以继承箭头现在从 SubCustomer指向Customer实体。

然后,我将垂直继承的东西应用到SubCustomer类,并使用“ Default * mapping *”将“ SubName ”字段映射到 Customer 类中的“ CustomerName 字段。从数据库模型更新和验证所有过程已成功完成,没有任何错误或警告。

在我的 Web 应用程序中部署此上下文并进行如下查询时:

我收到一个错误:

*错误执行查询:Telerik.OpenAccess.RT.sql.SQLException:无效的对象名称'SubCustomer。在 Telerik.OpenAccess.RT.Adonet2Generic.Impl.PreparedStatementImp.executeQuery() 在 OpenAccessRuntime.Relational.conn.PooledPreparedStatement.executeQuery() 在 OpenAccessRuntime.Relational.fetch.FetchResultImp.Execute() SQL: SELECT a.[CustomerID] AS COL1 , b.[voa_class] AS COL2, a.[SubName] AS COL3, b.*

我也尝试查询“ Customer ”实体,但遇到相同的错误。请帮忙。

问候,普拉文。

0 投票
1 回答
867 浏览

c# - 执行查询时出错:Telerik.OpenAccess.RT.sql.SQLException:无效的对象名称“员工”

我在我的 asp.net C# Web 应用程序中使用 Telerik Open Access ORM。在我的应用程序中,我将数据库中名为“Person”的表实体映射 为基类,并创建了一个名为“Employee”的子域类。然后我将子类的垂直继承应用到基类,并为员工子类使用“默认映射”。

在查询 Base/Sub 类时出现错误:

执行查询时出错:Telerik.OpenAccess.RT.sql.SQLException:对象名称“员工”无效。

这些是添加到从上下文查询的行:

请帮忙。

0 投票
2 回答
158 浏览

.net - IList 在什么时候导致查询在 ORM 中执行?

我正在使用 Telerik 的 OpenAccess ORM,并且正在对生成的代码进行一些更改。对于具有导航属性(另一个表的键)的实体,这些属性会生成为 IList,如下所示:

首先,在什么时候SystemUsers实际查询数据库?它是一个 IList,所以我原以为这会在创建对象时针对数据库执行,但我知道事实并非如此。

我想要做的是过滤掉我所有生成的导航属性上的已删除项目,并且我一直在对 t4 模板进行更改以使用以下代码执行此操作:

本质上,这只是返回集合减去标记为删除的集合。我关心的是.ToList()它何时执行。我不想通过ToList()每次访问时都对数据库进行查询来减慢查询速度SystemUsers,但我也想过滤我的项目。我什至不确定这ToList()是否会导致数据库命中。我不确定代码何时会真正命中数据库,因此我正在寻找一些帮助/提示来过滤掉我已删除的项目而不使其命中数据库,直到我SystemUsers通过添加更多过滤器(where 子句, ETC)。

0 投票
1 回答
511 浏览

vb.net - 自定义延迟加载开放存取 ORM

我正在使用开放访问 orm,我需要一种简单的方法来获取父实体信息并自定义加载相关子信息。我的意思是当我要求订单时,我只想要订单信息并且能够加载或不加载订单信息。

如果我有:

如果我愿意,我该怎么办,例如:

而且我需要该查询只是为了检索订单数据而不是 OrderLines,这似乎是 OA 默认执行的操作。

编辑:我已经尝试过这个:

我仍在接收 OrderLines 数据,我并不总是需要该数据。telerik 的大多数示例都将加载相关数据,但我想要相反。有没有办法指定我是否想要这样做?我希望清楚:/

0 投票
1 回答
325 浏览

model-view-controller - Telerik Openaccess ORM 扩展领域模型

我是 Telerik OpenAccess ORM 的新手,并使用数据库优先方法用于 MVC 项目。我在他们的网站上浏览了这个关于模型的教程视频: http ://tv.telerik.com/watch/orm/building-a-mvc-3-application-database-first-with-openaccess-creating-model?seriesID= 1529

我很想知道如何从 Modal 扩展域类和查询数据库?例如,我有一个生成的“Person”类,我正在使用以下类对其进行扩展:

这与上面视频中显示的示例非常相似。我很好奇是否可以从满足特定条件的 Person 表或 Person 对象集合中检索所有记录?我的“退货”查询将如何?我在这个扩展的模型类中没有可用的 dbContext :(

0 投票
1 回答
71 浏览

orm - 将 Silverlight 数据访问移植到 WPF

这个项目用 Silverlight 编写并使用 Telerik 开放访问 如何访问 WPF 中的数据?如何将 Silverlight 中的数据访问移植到 WPF。

如果有人想帮忙,我可以上传源代码。

谢谢大家的帮助。

0 投票
1 回答
78 浏览

asp.net - 无法区分链接表达式中的记录

我有两张桌子:TblAppointmentTypesTblEmployeeInfo。这两个表之间存在多对多关系,连接表是TblEmployeeServices. 中有 2 条记录, 中有TblAppointmentTypes4 条记录TblEmployeeInfo。的所有两条记录TblAppointmentTypes都分配给 中的所有记录TblEmployeeInfo,即 中有 8 条记录TblEmployeeServices。我想检索分配给所有四个的所有服务Employees,它应该返回分配给所有四个员工的 2,但是我的查询返回 8 条记录,四个重复的服务。

我正在使用 Telerik Open Access ORM。这是代码:

0 投票
2 回答
245 浏览

c# - Linq 复杂搜索导致 NullReferenceException

我在统一搜索功能中使用了以下 LINQ 代码。

目标是在 objectA 的 Name 字段或相关 objectB 的 Name 或 ID 字段中查找搜索词。问题是,当我尝试枚举 searchObjects 时,它只返回 NullReferenceException,没有更多详细信息。

查询的第一部分返回组合对象的正确列表(没有任何过滤器),所以我认为问题不在于左连接?

我无法弄清楚是什么导致了异常,所以任何帮助将不胜感激。

我也在使用 Telerik 的 OpenAccess ORM,但我认为这不会造成任何问题吗?

编辑:

原来这是 Telerik OpenAccess ORM 的一个问题,在某些情况下,它只会放弃生成合理的 SQL,将所有内容都绘制到内存中并将其视为 L2Objects(如@Dead.Rabit 所指出的那样,它应该在 null 上失败) . 似乎至少部分问题的条件是 .DefaultIfEmpty() 前面的 .Where(o => o.Type == "BasicGroup")。更新到最新版本的 OpenAccess(我认为是 2013 Q1 SPI)允许我重写该条件作为 equals 语句的一部分

这在 SP1 之前是不可能的。使用这个新查询,我可以将搜索词 Where 子句组合到查询中,并且仍然让它生成 SQL,而不是将其绘制到内存中。

0 投票
1 回答
7528 浏览

c# - IQueryable.Distinct() vs List.Distinct()

I have a linq query that I am using Distinct() on. If I just call Distinct() without converting to a List then it does not return a distinct list - it still contains duplicates.

However if I convert to a List and then call Distinct() - it works as expected and I only get unique objects.

I'm using Telerik ORM and the objects being returned are the class representing one of the tables in the database.

The code above does not produce distinct results, however when I convert to a list and call distinct - it does:

I suspect this has to do with the collection before being converted to a list, comparing references to objects rather than the object data itself but I do not fully understand what is going on - why does the fist code example not produce unique results and what happens to the collection when using .ToList() that makes it work?

[EDIT] I've simplified the above queries, in the real world the query has several joins which generates non-unique results, however I am returning just the User objects.

I tried overriding the Equals and GetHashCode methods but this did not make any difference.

[UPDATE] Having run the same query in LinqPad, it works as expected providing a list of distinct entries. However running the same query in LinqPad when using the Telerik ORM dll I get multiple entries. So it appears to be a peculiarity with Telerik. When I have time I will investigate further and raise it with Telerik support.

0 投票
1 回答
176 浏览

c# - Telerik OpenAccess GUID 被消隐

我正在尝试通过添加一个相对简单的实体Telerik.OpenAccess

该实体的一个属性是通过 c# 设置的 GUID GUID.NewGuid()

该属性在调用之前设置得很好,SaveChanges()但随后在 SQL Profiler 中查看该值全为 0。

有人经历过吗?在这里或 Telerik 的论坛上找不到任何建议,并且不知道如何取得进展。