两个dll(服务和接口)。对各种项目使用接口方法?

时间:2021-06-03 18:20:11

I have a pretty big web app which consists of a few different projects. I have to add some extra functionality (account validations, searching products etc). I was provided with two .dll files let's say Services.dll and Interfaces.dll.

我有一个很大的web应用程序,它由几个不同的项目组成。我必须添加一些额外的功能(帐户验证,搜索产品等)。我得到了两个。dll文件,比如说服务。dll和Interfaces.dll。

Services.dll includes three classes with several methods in them and Interfaces.dll their interfaces.

服务。dll包含三个类,其中包含几个方法和接口。dll接口。

Example:

例子:

//SERVICES.DLL
using Interfaces;

namespace Services
{
  internal class User : IUser
  {
    public Users GetUserByName (string Name)
    {
      //Implementation
    }
  }
}

//INTERFACES.DLL
namespace Interfaces
{
  public interface IUser
  {
    Users GetUserByName(string Name);
  }

  public class Users
  {
    public string FirstName {get; set;}
    public string LastName {get; set;}
  }
}

For implementing the extra features I need to use these methods in several of my included projects. How can this be achieved using the provided dlls? Is creating a web service using the dll a way? And then how both of them will be consumed by the service?

为了实现额外的特性,我需要在我的几个项目中使用这些方法。如何使用提供的dll实现这一点?使用dll创建web服务吗?那么它们将如何被服务消费呢?

Everything is implemented in C# and Net 2.0.

一切都是用c#和Net 2.0实现的。

1 个解决方案

#1


0  

I say it depends on how often these dlls are updated. You should choose whatever method is more convenient to update. The web service could be easy to update but could add unnecessary layers to your app and may be subject to bandwidth limitations. You could consider just adding the dll files in your web app directly as a reference to the files. Then update the dlls with new versions would require a rebuild/republish.

我说这取决于这些dll更新的频率。您应该选择任何更方便更新的方法。web服务很容易更新,但可能会给应用程序添加不必要的层,可能会受到带宽限制。您可以考虑直接在web应用程序中添加dll文件作为对文件的引用。然后用新版本更新dll需要重新构建/重新发布。

#1


0  

I say it depends on how often these dlls are updated. You should choose whatever method is more convenient to update. The web service could be easy to update but could add unnecessary layers to your app and may be subject to bandwidth limitations. You could consider just adding the dll files in your web app directly as a reference to the files. Then update the dlls with new versions would require a rebuild/republish.

我说这取决于这些dll更新的频率。您应该选择任何更方便更新的方法。web服务很容易更新,但可能会给应用程序添加不必要的层,可能会受到带宽限制。您可以考虑直接在web应用程序中添加dll文件作为对文件的引用。然后用新版本更新dll需要重新构建/重新发布。