none
Dynamic proxy generation RRS feed

  • Question

  • ive been using 

    http://blogs.msdn.com/b/vipulmodi/archive/2006/11/16/dynamic-programming-with-wcf.aspx#comments

    for Dynamic Programming with WCF

    ive been using this library and it works amazing...ive used for WCF service and am able to get the the input parameters(class file here) for my methods...my class file here is inherited from base class...so when i try to get the properties used am getting some one unknown like propertynamespecified etc..ie for eg if i have property name as UserStatus..i get UserStatus and UserStatusSpecified ...is there any way to get only the names ive used..?

    DynamicProxy dp = factory.CreateProxy(contractName);

           Type proxyType = dp.ProxyType;

           MethodInfo method = proxyType.GetMethod(methodName);

           ParameterInfo[] inputParameters = method.GetParameters();

           foreach (ParameterInfo pinfo in inputParameters)

           {

               DynamicProxyClass requestProxy = new DynamicProxyClass(factory.ProxyAssembly, pinfo.ParameterType.ToString());

               Type requestType = pinfo.ParameterType;

               foreach (PropertyInfo propertyInfo in requestType.GetProperties())

               {

                   Response.Write(propertyInfo.Name );

               }

           }

           dp.Close();

    earlier help is highly appreciated..


    Wednesday, November 13, 2013 2:11 PM

Answers

  • Hi,

    "Specified" fields are only generated on optional parameters that are structs. (int, datetime, decimal etc). All such variables will have additional variable generated with the name <variableName>Specified.

    This is a way of knowing if a parameter is really passed between the client and the server.

    To elaborate, an optional integer, if not passed, would still have the dafault value of 0.  How do you differentiate between this and the one that was actually  passed with a value 0 ? The "specified" field lets you know if the optional integer is passed or not. If the "specified" field is false, the value is not passed across. If it true, the integer is passed.

    Alternatively, you can consider using data types like int?, datatime? and this will avoid generation of the "specified" fields.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 15, 2013 5:57 AM
    Moderator