如何使用" post"在Object参数中检查列名是否存在WCF中的方法 [英] How to check the column name exists or not in the Object parameter using "post" method in WCF

查看:54
本文介绍了如何使用" post"在Object参数中检查列名是否存在WCF中的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在参数Object中找到或不存在特定列。因为我在WCF服务中使用''POST''方法将参数作为Object传递。任何人都可以帮我找到它吗?



例如:

How to find specific column exists or not in the parameter Object. Because i am passing parameter as a Object using ''POST'' method in WCF Service. Can anyone help me how to find it out?

for eg:

public static [Class Name] Update ([class Name] Object)
{
   string updateCommand="";
   updateCommand = " Update employee set employeeid = '" + object.employeeid + "'";
   return updateCommand;
}



这里我想检查对象中是否存在employeeid列名。如果对象中不存在,如何编写代码?



感谢你的帮助。


here i want to check the employeeid column name exists in the object or not. if it is not exists in the object , how to write the code?

thanks for your help in advance.

推荐答案

你的意思是你想检查对象的类型是否包含EmployeeId属性?如果这是真的,您可以使用反射来研究属性。例如:

Do you mean you want to check if the type of the object contains EmployeeId property? If that''s true, you can use reflection to investigate the properties. For example:
if (NameOfTheParameter.GetType().GetProperty("EmployeeId") != null) { ...



有关详细信息,请参阅 Type.GetProperty Method [ ^ ]


这篇关于如何使用" post"在Object参数中检查列名是否存在WCF中的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆