Import From Assembly Extension available

Oct 18, 2010 at 3:15 PM

The Import From Assembly Extension has been published with the invaluable help of hernandelahitte. Thanks Hernan!

This extension is a part of a wider effort which main goal is to achieve “service transparent” or “service ignorant” communication between client and business layer.

The idea is that in a WSSF solution with both .Net clients and services, the client should be able to call business methods without worrying about the service layer, and all this should be done without manual coding.

In order to be able to do it, the following conditions must be met:

  • Business layer entities should be POCOs declared in an independent assembly, referenced from both business and client layer, and they should be XML or DataContract serializable depending on the chosen implementation technology.
  • Service Distributor classes must be available in the client layer in order to act as a gateway between client calls to business method and service client calls to service operations.
  • Service Implementation classes also must act as a gateway between service operations requests and responses, and business logic method calls.
  • Business methods should be declared in a Business Facade interface (also referenced from both business and client layer), and both Business Logic and Service Distributor classes should inherit from this interface in order to guarantee common method signatures.

So, when adding or modifying business layer methods, only the above steps would be necessary:

  1. Code business methods in the business facade interface and compile the business facade assembly.
  2. Import this methods into the service contract model using the Import From Assembly Extension. This step will automatically add the operations and request / response messages needed, instead of manually adding them with the Service Contract Model Designer.
  3. Generate code with the Service Contract Model Designer. Additionally to what Service Factory normally generates, new code will be added:
  • Service Implementation methods with the code needed to disassemble the service contract operations requests, call the business layer methods and assemble their responses. This code will be added to the service implementation generated classes.
  • Service Distributor (client layer) methods with the code needed to do the opposite: assemble operation requests, call the service reference methods and disassemble their responses. This code will reside in new classes that will be available in the client layer.

In order to perform step #3 another extension with the corresponding T4 templates is needed. Its development is in-progress and will be available soon.

Please let me know any suggestion or feedback.