- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
Raven DB 可以使用哪些数据访问架构?
基本上,我想通过接口(interface)分离持久性,所以我不会将下划线存储暴露给上层。 IE。我不希望我的域看到来自 Raven DB 的 IDocumentStore 或 IDocumentSession。
我已经实现了通用存储库模式,这似乎行之有效。但是,我不确定这实际上是正确的方法。也许我应该转向命令查询隔离或其他东西?
你有什么想法?
最佳答案
就个人而言,我对命令模式并没有真正的经验。我看到它被用于Rob Ashton's excellent tutorial .
对于我自己,我将尝试使用以下内容:-
因此,当我希望从 RavenDB(持久性源)获取任何数据时,我将使用 Services,然后它将调用适当的存储库。这样,我就不会将存储库暴露给应用程序,存储库也不会非常繁重或复杂 -> 它基本上是一个 FindAll/Save/Delete。
例如。
public SomeController(IUserService userService, ILoggingService loggingService)
{
UserService = userService;
LoggingService = loggingService;
}
public ActionMethod Index()
{
// Find all active users, page 1 and 15 records.
var users = UserService.FindWithIsActive(1, 15);
return View(new IndexViewModel(users));
}
public class UserService : IUserService
{
public UserService(IGenericReposistory<User> userRepository,
ILoggingService loggingService)
{
Repository = userRepository;
LoggingService = loggingService;
}
public IEnumberable<User> FindWithIsActive(int page, int count)
{
// Note: Repository.Find() returns an IQueryable<User> in this case.
// Think of it as a SELECT * FROM User table, if it was an RDMBS.
return Repository.Find()
.WithIsActive()
.Skip(page)
.Take(count)
.ToList();
}
}
所以这是一个非常简单和人为的例子,没有错误/验证检查、try/catch 等......而且它是伪代码..但你可以看到服务是多么丰富而存储库(至少对我来说应该是)简单或更轻。然后我只通过服务公开任何数据。
这就是我现在使用 .NET
和 Entity Framework
所做的,而且我还需要几个小时才能使用 RavenDb
(哇!)
关于c# - Raven DB 的数据访问架构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5909400/
Raven.Client.Authorization 的当前版本是来自 Raven.Client 的版本。新的 Raven.Clients 允许您使用最新的 Json.Net 包,因此可以使用 Res
更具体地说,在Raven DB中,我想创建一个具有如下签名的通用方法: public void Clear() {... 然后让Raven DB清除给定类型的所有文档。 我从Ayende的其他帖子中了
我只是想确定 Raven DB 使用的文件系统上的文件是否加密?有人可以直接打开文件系统上的文件并将它们从二进制直接转换为 ASCII,还是加密? 我正试图说服我们的管理层给 RavenDB 一个机会
我正在尝试将带有异常报告的附加数据传递给sentri。 测试代码 Raven.captureMessage("test", {"blabla": "blabla"}) 在sentri admin中我可
我已经配置了raven来获取错误日志,我已经在哨兵控制面板中成功获取了日志,但是设置完成后,控制台日志就消失了。 我什至尝试通过在配置时将autoBreadcrumbs设置为false,仍然没有运气
我已经installed raven-js using Bower我正在使用 captureMessage()向 Sentry 发送自定义消息。 发送其中一条消息后,我需要重新加载页面。问题是,如果我
我需要获取特定集合中的文档计数: 现有索引 Raven/DocumentCollections 存储与属于该集合的实际文档配对的集合的计数和名称。如果可能的话,我想从此索引中获取计数。 这是 Rave
我正在构建一个脚本来检查损坏的索引并重置它们,但我在本地获取损坏的索引时遇到问题。 有人知道如何强制 RavenDB 索引损坏吗? 最佳答案 要导致损坏,您可以删除头文件之一(headers.one
有没有办法查询 RavenDB 文档存储并找出陈旧索引的陈旧程度? 本质上,我想做的是将结果提供给用户,同时也让他们了解还需要完成多少索引。 这在大数据导入场景中会很好。 最佳答案 当然,你可以这样做
我有一个打开版本控制包的数据库。我进行导出,然后尝试将导出的转储导入到新创建的数据库中。我收到异常“不允许修改历史修订版”。我发现this Ayende 的问答,这是设计使然。但是,如果版本控制包已打
我在查询 RavenDB 时遇到了问题,即使是最简单的查询,可能我做错了什么,但几个小时后我就看不到它了。我用谷歌搜索了几乎所有我能想到的东西.. 我有这些实体: public class U
我使用以下日志配置在 Django 1.4 上配置了 Raven 2.0.2: 'handlers': { ... 'sentry': { 'level':'INFO'
我有一个树结构,其中的节点同时具有子指针和父指针。我在让它很好地序列化时遇到了一些问题(这将用于配置,因此它需要对操作/配置管理器有一定的可读性),并且在尝试了序列化约定和属性的不同组合之后我仍然卡住
Raven DB 可以使用哪些数据访问架构? 基本上,我想通过接口(interface)分离持久性,所以我不会将下划线存储暴露给上层。 IE。我不希望我的域看到来自 Raven DB 的 IDocum
我正在使用 raven 和 getsentry 在 django 中记录消息,但记录似乎延迟了代码的执行。例如: # ...view code tic = datetime.datetime.now(
我有这样的代码: public bool Set(IEnumerable requests) { var documentSession = _documentStore.Op
我有以下 2 个实体模型: public class Store : IModel { public string Id { get; set; }
谁能帮我加快这个查询速度?我正在使用 RavenDB 3.5.8 并且以下查询需要相当长的时间(在第一次加载时尤其如此): var query = session .Q
我正在寻找一种在 Raven DB 中生成测试数据的首选且可维护的方式。目前,我们的团队确实有办法通过 .NET 代码来做到这一点。提供了示例。 但是,我正在寻找不同的选择。请分享。 public v
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我是一名优秀的程序员,十分优秀!