是什么打破了.net二进制(dll)接口 [英] What breaks a .net binary (dll) interface

查看:151
本文介绍了是什么打破了.net二进制(dll)接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑两个.net dll。第一个,application.dll包含主要的业务逻辑和数据访问代码。第二个,webservice.dll主要由WebMethods组成,它们通过application.dll链接到对象和方法,目的是为现有代码提供webservice调用。

Consider two .net dlls. The first, "application.dll" contains the main business logic and data access code. The second, "webservice.dll" consists mostly of WebMethods that link to objects and methods with application.dll for the purpose of providing webservice calls to existing code.

有什么变化(例如,添加新类,向现有类添加新字段或方法等)可以也不能对application.dll进行,而无需重新编译webservice.dll?

What changes (e.g. add new classes, add a new field or method to an existing class etc) can and can't be made to application.dll without requiring a recompile of webservice.dll?

推荐答案

大多数事情都会好起来的;一些会破坏它的东西:

Most things will be fine; some things that will break it:


  • 删除使用的*类型(除非你使用的是类型转发)

  • 删除使用的*方法(包括构造函数)

  • 更改方法的签名(使用的方法)

  • 更改公共字段属性(使用的)

  • 如果使用序列化,则更改序列化内部结构

  • 向接口添加方法,其中第二个dll具有类型实现该接口

  • 将抽象方法添加到第二个dll中继承的基类

  • 如果hacky反射,几乎任何内部的( ab)使用

  • 向泛型类型/方法添加约束

  • 将类型标记为已密封当它在第二个dll中继承时

  • 如果调用者使用成员初始化而不是构造函数初始化,则将字段添加到 struct / li>
  • Removing* types that are used (unless you are using type-forwarding)
  • Removing* methods that are used (including constructor)
  • Changing the signature of methods (that are used)
  • Changing public fields to properties (that are used)
  • Changing serialization internals if serialization is used
  • Adding a method to an interface, where the second dll has a type that implements that interface
  • Adding an abstract method to a base-class that is inherited in the second dll
  • Almost anything internal if hacky reflection is (ab)used
  • Adding constraints to a generic type/method
  • Marking a type as sealed when it was inherited in the second dll
  • Adding a field to a struct if the caller uses memberwise initialization rather than constructor initialization

(删除ing包括改变非公开的可访问性)

(removing includes changing the accessibility to something non-public)

这篇关于是什么打破了.net二进制(dll)接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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