问题描述
请原谅可能引起的任何刺激。
Please excuse any irritation that may come through.
因此,在使用早教课程一段时间后,我们的团队注意到了一些使早教课程变得很漂亮的缺点。
So after using the early bound classes for a while now our team has noticed some cons that make early bound classes pretty useless.
问题:
- 速度慢,因为它必须连接到ws并翻过http,甚至认为它与系统的其余部分都在同一进程中运行。
- 在插件中附加到CREATE消息时会导致sql死锁。
- 对系统的任何细微更改,都需要重新生成类,并且一切都会中断。
那么它们何时有用?有关这方面资料的MS文档在哪里?
So when are they useful? Where's MS documentation on this stuff? Besides how to generate them tutorials.
谢谢,
Jon
Thanks,Jon
推荐答案
我们通常在开发中使用早期绑定类型。如果您开发业务逻辑(类型安全性,...),它们就很有意义。
We mostly use early bound types for our development. They make sense if you develop business logic (type safety, ...).
但是,后期绑定方法仍有空间。当我们不得不保持通用性并且无法预测目标系统的外观时,我们正在使用后期绑定开发。或者,如果您开发了可以以多种方式配置的可重用组件(例如数字生成器)。
However, there is still room for the late bound approach. We are using late bound development, when we have to stay generic and can't predict how the target system looks like. Or if you develop some reusable component which could be configured in multiple ways (like a number generator).
在这一点上,早期和晚期编程之间没有区别。在数据上下文中使用 .Update()
更新后绑定实体并调用 SaveChanges()
有什么区别?在插件中使用早期绑定类时,您不必显式调用Web服务。
There is no difference between early and late bound programming in this point. Where is the difference of updating a latebound entity with .Update()
and calling SaveChanges()
on your data context? You don't have to call the webservice explicitly when you are using early bound classes in plugins.
不是由早期绑定类型引起的。造成这种现象的其他原因。
That is not caused by early bound types. There are other reasons for this behavior.
我也不同意这一点。
Account.Foo = "some data here";
或使用实体
Entity["new_foo"] = "some data here";
如果您在 new_foo
中进行了更改用早期和晚期绑定类来处理。但是,如上所述,如果您不知道使用早期绑定类的目标环境,如果生成的属性引用的字段不可用,则会导致问题。
If you have changes at new_foo
you have to handle that with early and late bound classes. However, as mentioned above, if you don't know the target environment using early bound classes could lead to issues if the fields referenced by the generated properties are not available.
这篇关于早期绑定类用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!