那里有参考资料可以吗?

发布于 2024-08-23 06:30:54 字数 673 浏览 7 评论 0原文

我正在使用 Castle ActiveRecord 构建一个新项目,并且有一些技术问题。

我构建了项目工作区并添加了 5 个项目。

  • ViewModel 用于接口和应用程序逻辑
  • Model 用于基本模型类
  • Test 用于单元测试
  • Client 用于我的 WPF 客户端
  • < strong>data 为我的数据源

然后我在 ModelViewModeldata 项目中添加了对 Castle.ActiveRecord 的一些引用。我认为我的项目中不应该有这么多对 ActiveRecord 的引用。一般来说,在数据项目中,但模型类有其装饰器来让 AR 工作。当 ModelView 中没有对 AR 的引用时,当我定义 dao 的接口时,我的 ModelView 中没有对 AR 的引用,就会出现错误。

这主要是一个设计问题而不是功能问题。确实会创建一些当我后来决定使用另一个数据源时不会有的依赖项。

是否可以在各处添加对 AR 的引用,或者我如何以其他方式解决这个问题?

谢谢鲍里斯

I am building a new project with Castle ActiveRecord and have a little technical question.

I build my projects workspace and added 5 projects.

  • ViewModel for interfaces and application logic
  • Model for the basic model classes
  • Test for unit testing
  • Client for my WPF client
  • data for my datasource

Then i added some references to Castle.ActiveRecord in Model, ViewModel and data project. I think i should not have so many referrences to ActiveRecord in my project. In general in the data project but the model class has its decorators to get the AR to work. When there is no reference to AR in the ModelView it gets errors when i define my interfaces to the dao that there is no reference to AR in my ModelView.

Its mainly a design question not a functional thing. Is does create some dependencies that i would not have when i later decide to use another datasource.

Is it ok to add references to AR everywhere or how can i solve this on another way?

Thanks Boris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只有一腔孤勇 2024-08-30 06:30:54

ActiveRecord 应该比 NHibernate 更具侵入性,因为它不使用纯 POCO。如果您确实想避免这些引用,请改用 NHibernate。

不管怎样,恕我直言,你那里的项目太多了。 ViewModel 项目中的应用程序逻辑听起来不正确。请参阅本文了解一些基本原理以减少项目数量。

ActiveRecord is supposed to be more invasive than NHibernate since it doesn't use pure POCOs. If you really want to avoid those references use NHibernate instead.

Anyway, IMHO you have way too many projects there. And application logic in the ViewModel project doesn't sound right. See this article for some rationale to keep the amount of projects down.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文