How to specify a WCF known type in config that is generic?

前端 未结 2 2019
情歌与酒
情歌与酒 2021-02-03 13:36

I have a type, let\'s call it Data. I also have a WCF service contract that accepts a type (lets call it Wrapper) with a property of type

2条回答
  •  庸人自扰
    2021-02-03 13:48

    From here...

    Known types can also be defined in config as shown below.

    
      
        
          
             
                
                        
                
             
          
        
      
    
    

    The above config specifies that the generic parameter for Circle is the same as the generic parameter for the declared type Shape. The config allows the definition of known type of arbitrary complexity. For example if it is needed to define Circle< Dictionary< string, T >> as the known type of Shape< T > (of course this is purely academic) it can be done as follows.

    
      
        
          
             
                
                       
                          
                          
                                       
                
             
          
        
      
    
    

    Note the use config element “parameter” with the attributes ‘type’ and ‘index’.

提交回复
热议问题