GetKnownTypes for dynamic known type list
See original GitHub issueWCF in .Net framework had an overload for ServiceKnownType as follows:
[ServiceKnownType("GetKnownTypes", typeof(DataProviderTypes))]
public interface IService
{
}
public class DataProviderTypes
{
public static IEnumerable<Type> GetKnownTypes(ICustomAttributeProvider provider)
{
List<Type> lst = new List<Type>();
'
'
return lst;
}
}
This allowed to dynamically generate list of known types.
Is there any way to achieve this ? If not, when is this planned ? Coz this is looking like a showstopper.
Thanks
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How do you configure WCF known types programmatically?
In the GetKnownTypes method, which is just code, you can return the known types at that point in time. The attribute is just...
Read more >Data Contract Known Types - WCF
Learn how the data contract model uses the KnownTypeAttribute class to specify the types to include during deserialization in WCF.
Read more >add known types to wcf service dynamically
After some experiences I camed out to the following code. It takes care of finding the missing types used in an operation contract....
Read more >Writing Highly Maintainable WCF Services
Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the ......
Read more >Part 7 KnownType attribute in WCF - YouTube
... inherited types, then use KnownType attribute. There are other ways of associating known types, which we will discuss in next video session....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, a new ServiceKnownTypeTests.cs can be created. Feel free to open a draft PR so that you can get some feedback before you are complete if you would like. I’m happy with reducing the usage of CustomAttributeProvider and relegating it to only being used to get custom attributes including the converting System.ServiceModel variations to CoreWCF ones. I think we could get away with turning it into a static class and making the method an extension method on ICustomAttributeProvider. Probably need to rename it otherwise the ICustomAttributeProvider version of the method would get called instead. I’m open to any cleanup you would like to do, or you can make the minimal changes required. It’s up to you.
That comment is a holdover from very early .NET Standard days when that interface wasn’t available. It wasn’t the reason why that overload wasn’t supported though. It was because this code was originally ported for UWP apps running on .NET Native which didn’t allow reflection and dynamically calling of methods. This can definitely be re-enable. I’ll take a look later to see how much work this will be.