- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Northwind 示例的 Customer DTO 中,有一个字段 Email
是合成的——即它不是来自数据库。此处代码:https://github.com/ServiceStackApps/Northwind/blob/master/src/Northwind/Northwind.ServiceModel/Types/Customer.cs
但是在运行的例子中查看时,这个字段是不可见的: http://northwind.servicestack.net/query/customers
我注意到这个 DTO 有 [DataContract] 和 [DataMember] 注释,而大多数其他示例没有。
如何将合成字段添加到 AutoQuery?只需添加一个带有 pupulated getter 的方法就会给我一个错误,因为 ServiceStack 试图从数据库中获取它。是否应该使用“忽略”注释?或者最好的方法是将“DTO-for-database”和“DTO-for-the-service”分开,并以某种方式在它们之间使用 AutoMapper?
最佳答案
Is there an "Ignore" annotation that should be used?
正是这样,使用[Ignore]
忽略在OrmLite 中使用的字段或 AutoQuery而 [IgnoreDataMember]
是您想要在序列化中忽略该属性的时候。
Email
字段没有显示,因为它在 [DataContract]
类中没有 [DataMember]
字段是ignore fields in Serialization with ServiceStack.Text的方法之一.
关于ServiceStack AutoQuery 合成字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55246074/
当我查询 AutoQuery 服务(常规 GET 请求)时,我会在日志中收到警告,即使请求工作正常。 URL 的警告如下所示:https://localhost:5001/employees?Birt
在 Northwind 示例的 Customer DTO 中,有一个字段 Email 是合成的——即它不是来自数据库。此处代码:https://github.com/ServiceStackApps/
我们正在尝试使用 JsonServiceClient 手动构造自动查询请求。对于大多数操作来说,代码非常简单,但我看不到过滤器是如何应用的: var client = new JsonServiceC
我正在使用 ElasticSearch 和 Haystack 来实现搜索功能。 配置完所有内容后,我创建了一个继承自 SearchView 的自定义 View : class CustomSearch
我正在尝试使用 ServiceStack 的 Auto Query针对多次引用另一个表 B 但无法使其工作的表 A 的功能。 问题的根源似乎是 AutoQuery 生成联接时没有为联接表添加别名,从而
我想从我的自定义 AutoQuery 端点返回一个自定义类,它继承了 QueryResponse但增加了一些额外的属性。 public class WritingAssignmentBlogLookU
我针对具有大约 130 万行的两个表的简单连接设置了 AutoQuery。使用内置的迷你分析器来测量 SQL 时间,返回前 100 行(无过滤)的查询需要 3 毫秒,计数需要额外的 341 毫秒。 是
我是一名优秀的程序员,十分优秀!