创建wcf服务库的时候,系统自动生成的代码

 // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“IService1”。
[ServiceContract]
public interface IService1
{
[OperationContract]
string GetData(int value); [OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite); // TODO: 在此添加您的服务操作
} // 使用下面示例中说明的数据约定将复合类型添加到服务操作。
// 可以将 XSD 文件添加到项目中。在生成项目后,可以通过命名空间“WcfServiceLib.ContractType”直接使用其中定义的数据类型。
[DataContract]
public class CompositeType
{
bool boolValue = true;
string stringValue = "Hello "; [DataMember]
public bool BoolValue
{
get { return boolValue; }
set { boolValue = value; }
} [DataMember]
public string StringValue
{
get { return stringValue; }
set { stringValue = value; }
}
}

服务实现

// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“Service1”。
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
} public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}

What code you will get when you create a wcf library的更多相关文章

  1. Error Code: 1786 Statement violates GTID consistency: CREATE TABLE ... SELECT.

    1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:call account_check_main('20180511') 错误 ...

  2. Create an Android library

    官方文档 创建 Android 库 [Create an Android library] Android 库在结构上与 Android app module 相同.它可以提供构建应用所需的一切内容, ...

  3. 15个最佳的代码评审(Code Review)工具

    代码评审可以被看作是计算机源代码的测试,它的目的是查找和修复引入到开发阶段的应用程序的错误,提高软件的整体素质和开发者的技能.代码审查程序以各种形式,如结对编程,代码抽查等.在这个列表中,我们编制了1 ...

  4. Optimize Managed Code For Multi-Core Machines

    Parallel Performance Optimize Managed Code For Multi-Core Machines Daan Leijen and Judd Hall This ar ...

  5. Oracle Applications Multiple Organizations Access Control for Custom Code

    档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...

  6. 翻译:CREATE DATABASE语句

    */ .hljs { display: block; overflow-x: auto; padding: 0.5em; color: #333; background: #f8f8f8; } .hl ...

  7. SQLITE WITH ENTITY FRAMEWORK CODE FIRST AND MIGRATION

    Last month I’ve a chance to develop an app using Sqlite and Entity Framework Code First. Before I st ...

  8. How to Create a Framework for iOS[RE]

    In the previous tutorial, you learned how to create a reusable knob control. However, it might not b ...

  9. 项目管理系列--好用的代码评审(Code Review)工具

    1. Gerrit Gerrit is a web based code review system, facilitating online code reviews for projects us ...

随机推荐

  1. arduino相关文献阅读

    首推这个 https://wenku.baidu.com/view/e657b1f0bcd126fff6050baf.html 用Arduino IDE开发程序流程 当程序编写好之后,关闭前需要将文件 ...

  2. PL/SQL Developer 报错Dynamic Performance Tables not accessible, Automatic Statistics disabled for this session You can disable statistics in the preference menu, or obtain select priviliges on the V$ses

    可以从以下几个方面考虑: 1)单独给用户授动态性能视图的权限: SQL> grant select on V_session  to user; SQL> grant select on  ...

  3. 20190906 On Java8 第十八章 字符串

    第十八章 字符串 +的重载与StringBuilder 用于String的+与+=是Java中仅有的两个重载过的操作符,Java不允许程序员重载任何其他的操作符.编译器自动引入了java.lang.S ...

  4. FileSystemObject详解

    FSO是FileSystemObject 或 Scripting.FileSystemObject 的缩写,为 IIS 内置组件,用于操作磁盘.文件夹或文本文件.FSO 的对象.方法和属性非常的多,这 ...

  5. [Git] 005 初识 Git 与 GitHub 之分支

    在 GitHub 的 UI 界面使用 Git(多图警告) 1. 建立分支 1.1 点击左上方的 Branch: master,在输入框中填入分支名,再点击下方的 Create branch 1.2 此 ...

  6. Python 函数知识总汇

    函数在一个程序起到很重要的作用,那么如何学好函数呢,那函数有什么内容的,总结一下函数的知识归类 1,函数定义 def  函数名(): print("...") 2,函数返回值 re ...

  7. C# EF优化

    原文:https://www.cnblogs.com/wangyuliang/p/10338902.html   https://www.cnblogs.com/simadi/p/6879366.ht ...

  8. Version Controlling with Git in Visual Studio Code and Azure DevOps

    Overview Azure DevOps supports two types of version control, Git and Team Foundation Version Control ...

  9. 跨域问题解决----NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost:11000' is therfore not allowed access'

    NO 'Access-Control-Allow-Origin' header is present on the requested resource.Origin'http://localhost ...

  10. CSS中如何设置父元素透明度不影响子元素透明度

    原因分析: 使用css的opcity属性改变某个元素的透明度,但是其元素下的子元素的透明度也会被改变,即便重定义也没有用,不过有个方法可以实现,大家可以看看. 可以使用一张透明的图片做背景可以达成效果 ...