Written in the front: reprint please indicate the source
Directory pinned:
- About Project--------------------WCF+EF+WPF layered framework based on DDD Domain driven design (1)
- Architecture--------------------WCF+EF+WPF Layered framework based on DDD Domain driven Design (2)
- WCF service-side specific implementation---------WCF+EF+WPF layered framework based on DDD Domain driven design (3)
- WCF client Configuration and proxy-----WCF+EF+WPF layered framework based on DDD Domain-driven design (4)
- Domain Specific implementation------------WCF+EF+WPF layered framework based on DDD Domain driven design (5)
- The UI layer of WPF-----------------WCF+EF+WPF layered Framework based on the DDD domain-driven design (6)
- Organizational structure--------------------WCF+EF+WPF layered framework based on DDD Domain driven design (7)
- Instant Messaging--------------------WCF+EF+WPF layered framework based on DDD Domain driven design (8)
- My Site
WCF server-specific implementations
I'll take a concrete example of the implementation of WCF server side
Organization structure
Add a WCF service under the Mainclient folder in this ACS.OA.WCFService (since I was partitioning the module, I partitioned the organization into settings, so the service is named SETTINGSERVICE.SVC) Delete SettingService.svc.cs and ISettingService.cs.
The SETTINGSERVICE.SVC code is as follows:
<%@ ServiceHost language="C #" debug="true" service=" ACS. Oa. WCFServiceLib.MainClient.SettingService "codebehind="SettingService.cs" %>
Add an interface under the Mainclient folder for the ACS.OA.WCFContract project ISettingService.cs
The Isettingservice code is as follows:
[ServiceContract] Public InterfaceIsettingservice {#regionIKE Network cloud OA organization structure[OperationContract]byte[] Getorgalist (byte[] bytdata); [OperationContract]byte[] Addorga (byte[] bytdata); [OperationContract]byte[] Updateorga (byte[] bytdata); [OperationContract]byte[] Deleteorga (byte[] bytdata); #endregion}
ALSA Oa. Add a class under the Mainclient folder of the Wcfservicelib project SettingService.cs
The Settingservice code is as follows:
1 Public classSettingservice:wcfservicelibbase, Isettingservice2 {3 #regionIKE Network cloud OA organization structure4 Public byte[] Getorgalist (byte[] bytdata)5 {6 Try7 {8 returnSettingServiceImpl.Instance.GetOrgaList (bytdata);9 }Ten Catch(Exception ex) One { A returnErrorlogrecode (ex); - } - } the Public byte[] Addorga (byte[] bytdata) - { - Try - { + returnSettingServiceImpl.Instance.AddOrga (bytdata); - } + Catch(Exception ex) A { at returnErrorlogrecode (ex); - } - } - Public byte[] Updateorga (byte[] bytdata) - { - Try in { - returnSettingServiceImpl.Instance.UpdateOrga (bytdata); to } + Catch(Exception ex) - { the returnErrorlogrecode (ex); * } $ }Panax Notoginseng Public byte[] Deleteorga (byte[] bytdata) - { the Try + { A returnSettingServiceImpl.Instance.DeleteOrga (bytdata); the } + Catch(Exception ex) - { $ returnErrorlogrecode (ex); $ } - } - #endregion the}
settingservice View Code
Interact with domain specifically, and I want to talk about it in subsequent chapters.
Go back to Project ACS.OA.WCFService find the Web. config to add the following code between <services> </services>:
<service behaviorconfiguration="Oatcpbehavior"Name="ACS. Oa. WCFServiceLib.MainClient.SettingService"> <endpoint binding="nettcpbinding"bindingconfiguration="oatcpbinding"Name="Settingservice"contract="ACS. Oa. WCFContract.MainClient.ISettingService"> <identity> <dns value="oamainclient"/> </identity> </endpoint> <endpoint address="Mex"binding="mextcpbinding"contract="IMetadataExchange"/> </service>
Right-click Build, and then Access local IIS (net.tcp needs to install local IIS) HTTP://LOCALHOST/DDD/ACS.CLOUDOA.WCFSERVICE/MAINCLIENT/SETTINGSERVICE.SVC
You can display the following information:
svcutil.exe net.tcp://Desktop-oeq0gl2/ddd/acs. Cloudoa.wcfservice/mainclient/settingservice.svc/mex
Net.tcp://desktop-oeq0gl2/ddd/acs. Cloudoa.wcfservice/mainclient/settingservice.svc/mex This is the address, change the middle desktop-oeq0gl2 to an IP address or a domain name
You can then use Svcutil to generate client-side proxy classes and client-side configuration information.
The implementation of the WCF service side is basically this step.
In the next section, I'll talk about "WCF Client configuration and proxy", and if you find it helpful, please continue to follow ... Thank you
WCF service-side specific implementation---------WCF+EF+WPF layered framework based on DDD Domain driven design (3)