Add support for reserved keywords like @object and @string (#18)

This commit is contained in:
Stef Heyenrath
2021-07-31 10:21:12 +02:00
committed by GitHub
parent c1359511d6
commit 541477b545
8 changed files with 188 additions and 165 deletions
@@ -1,86 +0,0 @@
using System;
using AutoMapper;
namespace ProxyInterfaceConsumer
{
public class PersonProxy2
{
public ProxyInterfaceConsumer.Person _Instance { get; }
public int Id { get => _Instance.Id; }
public long? NullableLong { get => _Instance.NullableLong; }
public string Name { get => _Instance.Name; set => _Instance.Name = value; }
public IAddress Address { get => _mapper.Map<IAddress>(_Instance.Address); set => _Instance.Address = _mapper.Map<ProxyInterfaceConsumer.Address>(value); }
public System.Collections.Generic.List<IAddress> AddressesLIst { get => _mapper.Map<System.Collections.Generic.List<IAddress>>(_Instance.AddressesLIst); set => _Instance.AddressesLIst = _mapper.Map<System.Collections.Generic.List<ProxyInterfaceConsumer.Address>>(value); }
public System.Collections.Generic.Dictionary<string, IAddress> AddressesDict { get => _mapper.Map<System.Collections.Generic.Dictionary<string, IAddress>>(_Instance.AddressesDict); set => _Instance.AddressesDict = _mapper.Map<System.Collections.Generic.Dictionary<string, ProxyInterfaceConsumer.Address>>(value); }
public ProxyInterfaceConsumer.E E { get => _Instance.E; set => _Instance.E = value; }
public ProxyInterfaceConsumer.IMyInterface MyInterface { get => _Instance.MyInterface; set => _Instance.MyInterface = value; }
public int Add(string s)
{
string s_dbccfd45ed944f58b12d83a4f907aa6c = s;
var result_caf8bee7109d4b77891b141c495b63ff = _Instance.Add(s_dbccfd45ed944f58b12d83a4f907aa6c);
return result_caf8bee7109d4b77891b141c495b63ff;
}
public IAddress AddAddress(IAddress a)
{
ProxyInterfaceConsumer.Address a_23d6262793aa4c90b77bb7a9d46710b2 = _mapper.Map<ProxyInterfaceConsumer.Address>(a);
var result_cd3011159452417bb585e0acfaeefddc = _Instance.AddAddress(a_23d6262793aa4c90b77bb7a9d46710b2);
return _mapper.Map<IAddress>(result_cd3011159452417bb585e0acfaeefddc);
}
public void In_Out_Ref1(in int a, out int b, ref int c)
{
int a_88b067399c9641d69ebd8f795ddfa7ee = a;
int b_9a4c5b7b7e4c427dbb4779f658602356;
int c_49084012db6e47f0b03626886b8b7848 = c;
_Instance.In_Out_Ref1(in a_88b067399c9641d69ebd8f795ddfa7ee, out b_9a4c5b7b7e4c427dbb4779f658602356, ref c_49084012db6e47f0b03626886b8b7848);
b = b_9a4c5b7b7e4c427dbb4779f658602356;
}
public void In_Out_Ref2(in IAddress a, out IAddress b, ref IAddress c)
{
ProxyInterfaceConsumer.Address a_e5af7467b9d24729a95a861a8cc87f27 = _mapper.Map<ProxyInterfaceConsumer.Address>(a);
ProxyInterfaceConsumer.Address b_3a7ae9dbab3344bc9f9736b113198331;
ProxyInterfaceConsumer.Address c_afcd2b8abb1a4b7eae2a10656744c28a = _mapper.Map<ProxyInterfaceConsumer.Address>(c);
_Instance.In_Out_Ref2(in a_e5af7467b9d24729a95a861a8cc87f27, out b_3a7ae9dbab3344bc9f9736b113198331, ref c_afcd2b8abb1a4b7eae2a10656744c28a);
b = _mapper.Map<IAddress>(b_3a7ae9dbab3344bc9f9736b113198331);
}
public void Void()
{
_Instance.Void();
}
public PersonProxy2(ProxyInterfaceConsumer.Person instance)
{
_Instance = instance;
_mapper = new MapperConfiguration(cfg =>
{
cfg.CreateMap<ProxyInterfaceConsumer.Address, IAddress>();
cfg.CreateMap<IAddress, ProxyInterfaceConsumer.Address>();
}).CreateMapper();
}
private readonly IMapper _mapper;
}
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace ProxyInterfaceConsumer
{
@@ -7,23 +8,32 @@ namespace ProxyInterfaceConsumer
private int PrivateId { get; }
public int Id { get; }
public object @object { get; set; }
public long? NullableLong { get; }
public string Name { get; set; }
public string? StringNullable { get; set; }
public Address Address { get; set; }
public List<Address> AddressesLIst { get; set; }
public Dictionary<string, Address> AddressesDict { get; set; } = new Dictionary<string, Address>();
public Dictionary<Address, Address> AddressesDict2 { get; set; } = new Dictionary<Address, Address>();
public E E { get; set; }
public IMyInterface MyInterface { get; set; }
public int Add(string s)
public string Add(string s, string @string)
{
return s + @string;
}
public void AddWithParams(params string[] values)
{
return 600;
}
public Address AddAddress(Address a)
@@ -33,19 +43,39 @@ namespace ProxyInterfaceConsumer
return a;
}
public void AddAddresses(params Address[] addresses)
{
}
public void In_Out_Ref1(in int a, out int b, ref int c)
{
b = 1;
}
public void In_Out_Ref2(in Address a, out Address b, ref Address c)
public int In_Out_Ref2(in Address a, out Address b, ref Address c)
{
b = new Address();
return 404;
}
public void Void()
{
}
public Task Method1Async()
{
return Task.CompletedTask;
}
public Task<int> Method2Async()
{
return Task.FromResult(1);
}
public Task<string?> Method3Async()
{
return Task.FromResult((string?)"");
}
}
public enum E
@@ -0,0 +1,119 @@
using System;
using AutoMapper;
namespace ProxyInterfaceConsumer
{
public class PersonProxy2 : IPerson
{
public ProxyInterfaceConsumer.Person _Instance { get; }
public int Id { get => _Instance.Id; }
public object @object { get => _Instance.@object; set => _Instance.@object = value; }
public long? NullableLong { get => _Instance.NullableLong; }
public string Name { get => _Instance.Name; set => _Instance.Name = value; }
public string? StringNullable { get => _Instance.StringNullable; set => _Instance.StringNullable = value; }
public IAddress Address { get => _mapper.Map<IAddress>(_Instance.Address); set => _Instance.Address = _mapper.Map<ProxyInterfaceConsumer.Address>(value); }
public System.Collections.Generic.List<IAddress> AddressesLIst { get => _mapper.Map<System.Collections.Generic.List<IAddress>>(_Instance.AddressesLIst); set => _Instance.AddressesLIst = _mapper.Map<System.Collections.Generic.List<ProxyInterfaceConsumer.Address>>(value); }
public System.Collections.Generic.Dictionary<string, IAddress> AddressesDict { get => _mapper.Map<System.Collections.Generic.Dictionary<string, IAddress>>(_Instance.AddressesDict); set => _Instance.AddressesDict = _mapper.Map<System.Collections.Generic.Dictionary<string, ProxyInterfaceConsumer.Address>>(value); }
public System.Collections.Generic.Dictionary<IAddress, IAddress> AddressesDict2 { get => _mapper.Map<System.Collections.Generic.Dictionary<IAddress, IAddress>>(_Instance.AddressesDict2); set => _Instance.AddressesDict2 = _mapper.Map<System.Collections.Generic.Dictionary<ProxyInterfaceConsumer.Address, ProxyInterfaceConsumer.Address>>(value); }
public ProxyInterfaceConsumer.E E { get => _Instance.E; set => _Instance.E = value; }
public ProxyInterfaceConsumer.IMyInterface MyInterface { get => _Instance.MyInterface; set => _Instance.MyInterface = value; }
public string Add(string s, string @string)
{
string s_ = s;
string @string_ = @string;
var result_33785274 = _Instance.Add(s_, @string_);
return result_33785274;
}
public void AddWithParams(params string[] values)
{
string[] values_ = values;
_Instance.AddWithParams(values_);
}
public IAddress AddAddress(IAddress a)
{
ProxyInterfaceConsumer.Address a_ = _mapper.Map<ProxyInterfaceConsumer.Address>(a);
var result_9487824 = _Instance.AddAddress(a_);
return _mapper.Map<IAddress>(result_9487824);
}
public void AddAddresses(params ProxyInterfaceConsumer.Address[] addresses)
{
ProxyInterfaceConsumer.Address[] addresses_ = addresses;
_Instance.AddAddresses(addresses_);
}
public void In_Out_Ref1(in int a, out int b, ref int c)
{
int a_ = a;
int b_;
int c_ = c;
_Instance.In_Out_Ref1(in a_, out b_, ref c_);
b = b_;
}
public int In_Out_Ref2(in IAddress a, out IAddress b, ref IAddress c)
{
ProxyInterfaceConsumer.Address a_ = _mapper.Map<ProxyInterfaceConsumer.Address>(a);
ProxyInterfaceConsumer.Address b_;
ProxyInterfaceConsumer.Address c_ = _mapper.Map<ProxyInterfaceConsumer.Address>(c);
var result_30316242 = _Instance.In_Out_Ref2(in a_, out b_, ref c_);
b = _mapper.Map<IAddress>(_b);
return result_30316242;
}
public void Void()
{
_Instance.Void();
}
public System.Threading.Tasks.Task Method1Async()
{
var result_19162058 = _Instance.Method1Async();
return result_19162058;
}
public System.Threading.Tasks.Task<int> Method2Async()
{
var result_1349218716 = _Instance.Method2Async();
return result_1349218716;
}
public System.Threading.Tasks.Task<string?> Method3Async()
{
var result_1352687748 = _Instance.Method3Async();
return result_1352687748;
}
public PersonProxy2(ProxyInterfaceConsumer.Person instance)
{
_Instance = instance;
_mapper = new MapperConfiguration(cfg =>
{
cfg.CreateMap<ProxyInterfaceConsumer.Address, IAddress>();
cfg.CreateMap<IAddress, ProxyInterfaceConsumer.Address>();
}).CreateMapper();
}
private readonly IMapper _mapper;
}
}