Add ProxyInterfaceConsumerViaNuGet project
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
public class Address
|
||||
{
|
||||
public int HouseNumber { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(ProxyInterfaceConsumer.Address))]
|
||||
public partial interface IAddress
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
public interface IMyInterface
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(ProxyInterfaceConsumer.Person))]
|
||||
public partial interface IPerson
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
public class Person
|
||||
{
|
||||
private int PrivateId { get; }
|
||||
public int Id { get; }
|
||||
|
||||
public long? NullableLong { get; }
|
||||
|
||||
public string Name { 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 E E { get; set; }
|
||||
|
||||
public IMyInterface MyInterface { get; set; }
|
||||
|
||||
public int Add(string s)
|
||||
{
|
||||
return 600;
|
||||
}
|
||||
|
||||
public void AddAddress(Address a)
|
||||
{
|
||||
AddressesDict.Add($"{AddressesDict.Count}", a);
|
||||
}
|
||||
|
||||
public void Void()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public enum E
|
||||
{
|
||||
V1,
|
||||
V2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static JsonSerializerOptions JsonSerializerOptions = new ()
|
||||
{
|
||||
WriteIndented = true
|
||||
};
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
IPerson p = new PersonProxy(new Person());
|
||||
p.Name = "test";
|
||||
var ap = new AddressProxy(new Address { HouseNumber = 42 });
|
||||
p.Address = ap;
|
||||
p.AddAddress(ap);
|
||||
p.AddAddress(new AddressProxy(new Address { HouseNumber = 1000 }));
|
||||
|
||||
Console.WriteLine(JsonSerializer.Serialize(p, JsonSerializerOptions));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AssemblyName>ProxyInterfaceConsumer</AssemblyName>
|
||||
<RootNamespace>ProxyInterfaceConsumer</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ProxyInterfaceGenerator" Version="0.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user