asp.net - Unboxing object -


i have web method accepts object

[webmethod] public static void getobject(object data) {  } 

also, have 2 classes:

class connectionstring {     public string connectionstring { get; set; }      public databasetype databasetype { get; set; } }  class path {     public string path { get; set; }      public bool isnetwork { get; set; } } 

on client side, using javascript, defined 2 similar classes well:

function connectionstring() {     this.connectionstring = '';     this.databasetype = 0; };  function path() {     this.path = '';     this.isnetwork = false; }; 

now, according user decision, can ether choose create log in database or file system. when send data method, object resulted null. if create method each object, works. there way unbox or desirialize object type ?

you need create 2 method overloads each take in 1 of possible classes. in current implementation engine not know classes should put in wsdl...

if using wcf use [knowntype] attribute specify classes method supports.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -