微风:为什么从Breeze.Sharp.BaseEntity继承? [英] breeze: why inheriting from Breeze.Sharp.BaseEntity?

查看:103
本文介绍了微风:为什么从Breeze.Sharp.BaseEntity继承?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经开始考虑使用BreezeSharp,因为我们有一个WebAPI ODATA服务,我们希望将其与ASP.NET站点一起使用(不涉及JavaScript,仅使用纯C#).

We've started considering using BreezeSharp as we have a WebAPI ODATA Service that we'd like to re-use with a ASP.NET site (no javascript involved, just pure C#).

不幸的是,我们只是注意到,根据文档,我们所有的模型实体现在都应该继承自Breeze.Sharp.BaseEntity.对我们而言这是不可行的,因为这意味着我们的业务模型中必须依赖Breeze.我们宁愿只对WebAPI服务保持这种依赖性.

Unfortunately, we just noticed that, according to the documentation, all of our model entities should now inherit from Breeze.Sharp.BaseEntity. That's a no go for us as this would mean having a dependency on Breeze in our business model. We'd rather keep this dependency on the WebAPI service only.

无论如何,我们可以避免这种情况吗?例如,当代理类不从BaseEntity继承时,它们就在客户端吗?

Is there anyway we could avoid this ? Having proxy classes on the client-side for instance when they don't inherit from BaseEntity ?

对此有何想法?

推荐答案

如果我理解正确,那么您唯一的担忧就是您不想在服务器模型中引用breeze#库.显然,就客户端和服务器实体类的紧密耦合而言,它们具有相同的属性,也可能具有共享的方法,这没有问题.我没有判断力;我只是想确认您的架构决策.

If I understand correctly, your only concern is that you don't want to refer to breeze# libraries in your server model. Apparently you have no issue with close coupling of your client and server entity classes in the sense that they have identical properties and perhaps shared methods as well. I'm not being judgmental; I'm merely trying to confirm your architectural decisions.

您是否考虑过 部分课程 ?

Have you considered partial classes?

您在服务器端业务模型项目中定义了不费吹灰之力的子类,并且

You define the partial class w/o breeze in your server-side business model project and link to that class source in your client model project ... where you keep the companion partial class with the client-specific functionality. That client partial class file specifies the breeze# base class.

使用它时,您可以将仅服务器逻辑隔离在驻留在服务器项目中但不在客户端项目中的部分类文件中.

While you are at it, you can segregate server-only logic in partial class files that reside in your server project but not in your client project.

由于Microsoft正在按照 通用应用" .

这篇关于微风:为什么从Breeze.Sharp.BaseEntity继承?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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