Expose different types of names (smoothing) from the assembly

This question is related to the previous, unanswered question , as I am still solving the same problem; it is a different approach.

I am currently using a third-party SOAP web service in a C # .NET project. Unfortunately, the generated client proxy classes and class members have names that do not match my current conventions.

Until it is said otherwise, I must assume that Svcutil does not support aliasing (although this seems to be most easily achieved at this level)

Now I am considering the possibility of transferring the consumption of web services to my own project, thus assembling, and just a link to other projects. I consider this, given that you can add some (presumably at the assembly level) declarations to publish public types with different names than those defined in the assembly.

My question is: is it possible to set different types / element names than those that are defined in the assembly, essentially their aliases?

For example, given the attribute of the magic assembly:

[assembly: AssemblyTypeAlias(
    Type = typeof(Foo.Bar.qux),
    Name = "Qux"
)]

Thus, projects referencing this assembly will have access to Foo.Bar.quxhow Foo.Bar.qux.

Of course, a similar class-level attribute will also be large, since the proxies created are partial:

namespace Foo.Bar
{
    [Alias("Qux")]
    public partial class qux 
    {
    }
}

Holding the same effect.

, , , .

. "", "", ; , .

+4
1

, XmlType , , , .

+1

Source: https://habr.com/ru/post/1531788/


All Articles