WCF 动态实现数据契约 ServiceKnownType
来源:互联网 发布:淘宝宝贝改销量 编辑:程序博客网 时间:2024/06/05 13:18
1.在WCF服务添加:
[ServiceKnownType("GetKnownTypes", typeof(KnownTypesProvider))]
2.添加类, 静态方法获取已知类型:
internal static class KnownTypesProvider { public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider) { return GetAssemblyOfType(); } public static List<Type> GetAssemblyOfType() { List<Type> listType = new List<Type>(); string[] files = Directory.GetFiles(AppDomain.CurrentDomain.SetupInformation.ApplicationBase); foreach (string s in files) { string str = s.ToUpper(); if (str.EndsWith(".DLL")) { try { Assembly ass = Assembly.LoadFrom(str); Type[] tps = ass.GetTypes(); foreach (Type t in tps) { if (t.BaseType == null) { continue; } if (t.BaseType.Name == "数据契约基类") { listType.Add(t); } } } catch (System.Exception ex) { } } } return listType; } }
0 0
- WCF 动态实现数据契约 ServiceKnownType
- wcf数据契约
- WCF 数据契约
- WCF契约设计: 服务契约,数据契约和消息契约
- WCF契约之---服务契约 、数据契约、 消息契约
- 化零为整WCF(2) - 契约Contract(ServiceContract、OperationContract、DataContract、ServiceKnownType和DataMember)
- 化零为整WCF(2) - 契约Contract(ServiceContract、OperationContract、DataContract、ServiceKnownType和DataMember)
- WCF数据契约(DataContract)
- WCF定义数据契约注意事项
- 谈WCF数据契约疑问之共享数据契约
- WCF --KnowType,ServiceKnownType,配置文件添加
- WCF契约的简单介绍(服务契约 数据契约 消息契约)
- WCF契约的简单介绍(服务契约 数据契约 消息契约)
- WCF契约的简介(服务契约、数据契约和消息契约)
- WCF契约的简单介绍(服务契约 数据契约 消息契约)
- WCF流与文件传输、数据契约和消息契约
- WCF编码规范(四)数据契约
- WCF学习笔记(三),数据契约
- TOMCAT架构分析
- 小常识
- 算法导论第三章函数的增长问题研究
- Android Developers:两个视图渐变
- 使用Unicode版的预定义宏__FUNCTION__
- WCF 动态实现数据契约 ServiceKnownType
- Crontab问题总结
- jar加载过程,动态加载
- Matlab中二维空间变换
- 5.13 内部类
- HttpClient4.x —— Cookie 版本
- 开发环境资料收集
- TECH: Summary For Forcing The Database Open With `_ALLOW_RESETLOGS_CORRUPTION` with Automatic Undo M
- /etc/fstab 文件解释