Use Mapster as mapper (#39)
* mapster * , * . * ... * . * . * . * . * . * . * int * . * ;
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mapster/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Usings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"profiles": {
|
||||
"WSL": {
|
||||
"commandName": "WSL2",
|
||||
"distributionName": ""
|
||||
"profiles": {
|
||||
"WSL": {
|
||||
"commandName": "WSL2",
|
||||
"distributionName": ""
|
||||
},
|
||||
"ProxyInterfaceConsumer": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<LangVersion>9</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -14,6 +13,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="Mapster" Version="7.3.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
// [ProxyInterfaceGenerator.Proxy(typeof(Microsoft.CodeAnalysis.GeneratorExecutionContext))]
|
||||
public partial interface IGeneratorExecutionContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(ProxyInterfaceConsumer.PersonTT<,>))]
|
||||
public partial interface IPersonTT<T1, T2>
|
||||
where T1 : struct
|
||||
where T2 : class, new()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces;
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public partial class ClientContextProxy
|
||||
{
|
||||
public Task ExecuteQueryRetryAsync(Interfaces.IClientRuntimeContext clientContext, int retryCount = 10, string? userAgent = null)
|
||||
{
|
||||
ClientRuntimeContext clientObject_ = Mapster.TypeAdapter.Adapt<ClientRuntimeContext>(clientContext);
|
||||
return clientObject_.ExecuteQueryRetryAsync(retryCount, userAgent);
|
||||
}
|
||||
|
||||
public void LoadOriginal<T>(T clientObject, params Expression<Func<T, object>>[] retrievals)
|
||||
where T : ClientObject
|
||||
{
|
||||
T clientObject_ = clientObject;
|
||||
Expression<Func<T, object>>[] retrievals_ = retrievals;
|
||||
_Instance.Load<T>(clientObject_, retrievals_);
|
||||
}
|
||||
|
||||
public void Load<TSource, TTarget>(Interfaces.IClientObject clientObject, params Expression<Func<TSource, object>>[] retrievals)
|
||||
where TSource : Interfaces.IClientObject
|
||||
where TTarget : ClientObject
|
||||
{
|
||||
TTarget clientObject_ = Mapster.TypeAdapter.Adapt<TTarget>(clientObject);
|
||||
Expression<Func<TTarget, object>>[] retrievals_ = retrievals.Select(MapExpression<TSource, TTarget>).ToArray();
|
||||
|
||||
_Instance.Load(clientObject_, retrievals_);
|
||||
}
|
||||
|
||||
private static Expression<Func<TTarget, object>> MapExpression<TSource, TTarget>(Expression<Func<TSource, object>> expression)
|
||||
where TSource : Interfaces.IClientObject
|
||||
where TTarget : ClientObject
|
||||
{
|
||||
var parameterExpression = Expression.Parameter(typeof(TTarget));
|
||||
|
||||
Expression memberAccessExpression;
|
||||
switch (expression.Body)
|
||||
{
|
||||
case MemberExpression memberExpression:
|
||||
memberAccessExpression = Expression.PropertyOrField(parameterExpression, memberExpression.Member.Name);
|
||||
break;
|
||||
|
||||
case UnaryExpression unaryExpression:
|
||||
var expressionOperand = (MemberExpression)unaryExpression.Operand;
|
||||
memberAccessExpression = Expression.PropertyOrField(parameterExpression, expressionOperand.Member.Name);
|
||||
memberAccessExpression = Expression.Convert(memberAccessExpression, typeof(object));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException();
|
||||
|
||||
}
|
||||
|
||||
return Expression.Lambda<Func<TTarget, object>>(memberAccessExpression, parameterExpression);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using ProxyInterfaceConsumerForPnP.Interfaces;
|
||||
|
||||
namespace ProxyInterfaceConsumerForPnP.Implementations;
|
||||
|
||||
public static class ClientRuntimeContextExtensions
|
||||
{
|
||||
public static Task ExecuteQueryRetryAsync(this IClientRuntimeContext clientContext, int retryCount = 10, string? userAgent = null)
|
||||
{
|
||||
ClientRuntimeContext clientObject_ = Mapster.TypeAdapter.Adapt<ClientRuntimeContext>(clientContext);
|
||||
return clientObject_.ExecuteQueryRetryAsync(retryCount, userAgent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(ClientContext))]
|
||||
public partial interface IClientContext : IClientRuntimeContext
|
||||
{
|
||||
void Load<TSource, TTarget>(IClientObject clientObject, params Expression<Func<TSource, object>>[] retrievals)
|
||||
where TSource : IClientObject
|
||||
where TTarget : ClientObject;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientObject))]
|
||||
public partial interface IClientObject
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientRuntimeContext))]
|
||||
public partial interface IClientRuntimeContext
|
||||
@@ -0,0 +1,10 @@
|
||||
//using System.Collections;
|
||||
//using System.Linq;
|
||||
|
||||
//namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
//{
|
||||
// [ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ListCollection))]
|
||||
// public partial interface IProxyListCollection: IClientObject, IEnumerable, IQueryable
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.SecurableObject))]
|
||||
public partial interface ISecurableObject : IClientObject
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.User))]
|
||||
public partial interface IUser
|
||||
{
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
namespace ProxyInterfaceConsumerForPnP.Interfaces
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.Web))]
|
||||
public partial interface IWeb: ISecurableObject
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
public class PersonTT<T1, T2>
|
||||
where T1 : struct
|
||||
where T2 : class, new()
|
||||
{
|
||||
public T1 TVal1 { get; set; }
|
||||
|
||||
public T2 TVal2 { get; set; }
|
||||
|
||||
public void Call(int x, T1 t1, T2 t2)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using AutoMapper;
|
||||
using Mapster;
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientContext))]
|
||||
public partial interface IClientContext: IClientRuntimeContext
|
||||
{
|
||||
// public virtual void X();
|
||||
}
|
||||
}
|
||||
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
{
|
||||
public class CustomResolver : IValueResolver<object, object, object>
|
||||
{
|
||||
public object Resolve(object source, object destination, object member, ResolutionContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
return member;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class MyConverter : ITypeConverter<object, object>
|
||||
{
|
||||
public object Convert(object source, object destination, ResolutionContext context)
|
||||
{
|
||||
return System.Convert.ToDateTime(source);
|
||||
}
|
||||
}
|
||||
|
||||
public class MyWebConverter : ITypeConverter<Web, IWeb>
|
||||
{
|
||||
public IWeb Convert(Web source, IWeb destination, ResolutionContext context)
|
||||
{
|
||||
return new ProxyInterfaceConsumer.PnP.WebProxy(source);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ClientContextProxy
|
||||
{
|
||||
public void Test()
|
||||
{
|
||||
var mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
//cfg.ForAllMaps((map, expression) =>
|
||||
//{
|
||||
// expression.ForAllMembers(configurationExpression =>
|
||||
// configurationExpression.PreCondition((o, o1, arg3) =>
|
||||
// {
|
||||
// return true;
|
||||
// })
|
||||
// );
|
||||
//});
|
||||
|
||||
// CreateMap<TSource, TDestination>();
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.Web, ProxyInterfaceConsumer.PnP.IWeb>()
|
||||
|
||||
.ConstructUsing((instance_841809920, context) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var p = new ProxyInterfaceConsumer.PnP.WebProxy(instance_841809920);
|
||||
return p;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
throw;
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
//.ConvertUsing<MyWebConverter>()
|
||||
|
||||
.ForAllMembers(opt =>
|
||||
{
|
||||
//opt.MapFrom(x =>x , );
|
||||
//opt.ConvertUsing<MyConverter, IWeb>( x=> x);
|
||||
|
||||
opt.PreCondition((src, dest, context) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var x = src != null;
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
opt.MapAtRuntime();
|
||||
|
||||
opt.MapFrom<CustomResolver>();
|
||||
})
|
||||
|
||||
|
||||
//.ConstructUsing(instance_841809920 => new ProxyInterfaceConsumer.PnP.WebProxy(instance_841809920))
|
||||
//.ForAllMembers(opt => {
|
||||
// opt.PreCondition((src, dest, context) =>
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var x = src != null;
|
||||
// return true;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
//})
|
||||
|
||||
;
|
||||
|
||||
|
||||
//cfg.CreateMap<ProxyInterfaceConsumer.PnP.IWeb, Microsoft.SharePoint.Client.Web>()
|
||||
// .ConstructUsing(proxy1898650104 => ((ProxyInterfaceConsumer.PnP.WebProxy)proxy1898650104)._Instance)
|
||||
// .ForAllMembers(opt => {
|
||||
// opt.PreCondition((src, dest, context) =>
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// var x = src != null;
|
||||
// return true;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
}).CreateMapper();
|
||||
|
||||
//var web = _mapper.Map<Web>(Web);
|
||||
//Load(web, w => w.Lists);
|
||||
|
||||
TypeAdapterConfig<Web, IWeb>.NewConfig().ConstructUsing(instance_841809920 => new ProxyInterfaceConsumer.PnP.WebProxy(instance_841809920));
|
||||
|
||||
TypeAdapterConfig<IWeb, Web>.NewConfig().MapWith(proxy1898650104 => ((ProxyInterfaceConsumer.PnP.WebProxy)proxy1898650104)._Instance);
|
||||
|
||||
var iweb = _Instance.Web.Adapt<IWeb>();
|
||||
var web = iweb.Adapt<Web>();
|
||||
|
||||
//var mapped = mapper.Map<ProxyInterfaceConsumer.PnP.IWeb>(_Instance.Web);
|
||||
|
||||
Load3(Web, w => w.Lists);
|
||||
}
|
||||
|
||||
public void LoadOriginal<T>(T clientObject, params System.Linq.Expressions.Expression<System.Func<T, object>>[] retrievals) where T : Microsoft.SharePoint.Client.ClientObject
|
||||
{
|
||||
T clientObject_ = clientObject;
|
||||
System.Linq.Expressions.Expression<System.Func<T, object>>[] retrievals_ = retrievals;
|
||||
_Instance.Load<T>(clientObject_, retrievals_);
|
||||
}
|
||||
|
||||
//public void Load2(IClientObject clientObject, params Expression<Func<IClientObject, object>>[] retrievals)
|
||||
//{
|
||||
// ClientObject clientObject_ = _mapper.Map<ClientObject>(clientObject);
|
||||
// Expression<Func<ClientObject, object>>[] retrievals_ = _mapper.Map<Expression<Func<ClientObject, object>>[]>(retrievals);
|
||||
|
||||
// _Instance.Load(clientObject_, retrievals_);
|
||||
//}
|
||||
|
||||
public void Load3(IWeb clientObject, params System.Linq.Expressions.Expression<System.Func<IWeb, object>>[] retrievals)
|
||||
{
|
||||
var clientObject_ = (WebProxy) clientObject;
|
||||
|
||||
//Expression<Func<WebProxy, object>>[] retrievals_ = _mapper.Map<Expression<Func<WebProxy, object>>[]>(retrievals);
|
||||
|
||||
Load(clientObject_._Instance, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,59 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using ProxyInterfaceConsumer.PnP;
|
||||
using PnP.Core.Model.SharePoint;
|
||||
using PnP.Framework;
|
||||
using ProxyInterfaceConsumerForPnP.Implementations;
|
||||
using ProxyInterfaceConsumerForPnP.Interfaces;
|
||||
using IWeb = ProxyInterfaceConsumerForPnP.Interfaces.IWeb;
|
||||
|
||||
namespace ProxyInterfaceConsumerForPnP
|
||||
namespace ProxyInterfaceConsumerForPnP;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public class Program
|
||||
public static async Task Main()
|
||||
{
|
||||
public static void Main()
|
||||
try
|
||||
{
|
||||
var cp = new ClientContextProxy(new ClientContext("https://heyenrath.nl"));
|
||||
cp.Test();
|
||||
var authManager = new AuthenticationManager(
|
||||
"15b347bf-90a2-4c16-aa76-5a3263476b59",
|
||||
"Test.pfx",
|
||||
Environment.GetEnvironmentVariable("Test.pfx_PWD"),
|
||||
"s7gb6.onmicrosoft.com");
|
||||
|
||||
using var clientContext = await authManager.GetContextAsync("https://s7gb6.sharepoint.com/sites/Test");
|
||||
clientContext.Load(clientContext.Web, p => p.Title);
|
||||
await clientContext.ExecuteQueryRetryAsync();
|
||||
|
||||
Console.WriteLine(clientContext.Web.Title);
|
||||
|
||||
IClientContext cp = new ClientContextProxy(clientContext);
|
||||
|
||||
cp.Load<IWeb, Web>(cp.Web, w => w.Lists, w => w.Language, w => w.Author);
|
||||
|
||||
await cp.ExecuteQueryRetryAsync();
|
||||
|
||||
Console.WriteLine(cp.Web.Title + "," + cp.Web.Language + "," + cp.Web.Author.Email);
|
||||
foreach (var list in cp.Web.Lists)
|
||||
{
|
||||
Console.WriteLine(" list : {0}", list.Title);
|
||||
}
|
||||
|
||||
foreach (var list in cp.Web.Lists)
|
||||
{
|
||||
cp._Instance.Load(list, l => l.Author.Email);
|
||||
}
|
||||
await cp.ExecuteQueryRetryAsync();
|
||||
|
||||
Console.WriteLine(new string('-', 80));
|
||||
foreach (var list in cp.Web.Lists)
|
||||
{
|
||||
Console.WriteLine(" list : {0} '{1}'", list.Title, list.Author.Email);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error Message: " + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<LangVersion>9</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="IPersonTT.cs" />
|
||||
<Compile Remove="PersonTT.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<!--<PackageReference Include="AutoMapper" Version="10.1.1" />-->
|
||||
<PackageReference Include="Mapster" Version="7.3.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
@@ -22,6 +16,7 @@
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.10.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.10.0" />
|
||||
<PackageReference Include="TinyMapper" Version="3.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -29,21 +24,33 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="PnP\ISecurableObject.cs">
|
||||
<Compile Update="Interfaces\ISecurableObject.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientObject.cs">
|
||||
<Compile Update="Interfaces\IClientObject.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IWeb.cs">
|
||||
<Compile Update="Interfaces\IListCollection.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="Interfaces\IUser.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="Interfaces\IWeb.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientContext.cs">
|
||||
<Compile Update="Interfaces\IClientContext.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientRuntimeContext.cs">
|
||||
<Compile Update="Interfaces\IClientRuntimeContext.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Test.pfx">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -219,4 +219,33 @@ internal abstract class BaseGenerator
|
||||
|
||||
return methodParameters;
|
||||
}
|
||||
|
||||
protected IReadOnlyList<ProxyData> GetExtendsProxyData(ProxyData proxyData, ClassSymbol targetClassSymbol)
|
||||
{
|
||||
var extendsProxyClasses = new List<ProxyData>();
|
||||
foreach (var baseType in targetClassSymbol.BaseTypes)
|
||||
{
|
||||
var candidate = Context.Candidates.Values.FirstOrDefault(ci => ci.FullRawTypeName == baseType.ToString());
|
||||
if (candidate is not null)
|
||||
{
|
||||
extendsProxyClasses.Add(candidate);
|
||||
break;
|
||||
}
|
||||
|
||||
// Try to find with usings
|
||||
foreach (var @using in proxyData.Usings)
|
||||
{
|
||||
candidate = Context.Candidates.Values.FirstOrDefault(ci => $"{@using}.{ci.FullRawTypeName}" == baseType.ToString());
|
||||
if (candidate is not null)
|
||||
{
|
||||
// Update the FullRawTypeName
|
||||
candidate.FullRawTypeName = $"{@using}.{candidate.FullRawTypeName}";
|
||||
|
||||
extendsProxyClasses.Add(candidate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return extendsProxyClasses;
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
|
||||
|
||||
fileData = new FileData(
|
||||
$"{sourceInterfaceSymbol.Symbol.GetFileName()}.g.cs",
|
||||
CreatePartialInterfaceCode(pd.Namespace, targetClassSymbol, interfaceName, pd.ProxyBaseClasses)
|
||||
CreatePartialInterfaceCode(pd.Namespace, targetClassSymbol, interfaceName, pd)
|
||||
);
|
||||
|
||||
return true;
|
||||
@@ -55,7 +55,12 @@ internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
|
||||
string ns,
|
||||
ClassSymbol classSymbol,
|
||||
string interfaceName,
|
||||
bool proxyBaseClasses) => $@"//----------------------------------------------------------------------------------------
|
||||
ProxyData proxyData)
|
||||
{
|
||||
var extendsProxyClasses = GetExtendsProxyData(proxyData, classSymbol);
|
||||
var @new = extendsProxyClasses.Any() ? "new " : string.Empty;
|
||||
|
||||
return $@"//----------------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
|
||||
//
|
||||
@@ -71,14 +76,17 @@ namespace {ns}
|
||||
{{
|
||||
public partial interface {interfaceName}
|
||||
{{
|
||||
{GenerateProperties(classSymbol, proxyBaseClasses)}
|
||||
{@new}{classSymbol.Symbol} _Instance {{ get; }}
|
||||
|
||||
{GenerateMethods(classSymbol, proxyBaseClasses)}
|
||||
{GenerateProperties(classSymbol, proxyData.ProxyBaseClasses)}
|
||||
|
||||
{GenerateEvents(classSymbol, proxyBaseClasses)}
|
||||
{GenerateMethods(classSymbol, proxyData.ProxyBaseClasses)}
|
||||
|
||||
{GenerateEvents(classSymbol, proxyData.ProxyBaseClasses)}
|
||||
}}
|
||||
}}
|
||||
{(SupportsNullable ? "#nullable disable" : string.Empty)}";
|
||||
}
|
||||
|
||||
private string GenerateProperties(ClassSymbol targetClassSymbol, bool proxyBaseClasses)
|
||||
{
|
||||
@@ -97,7 +105,7 @@ namespace {ns}
|
||||
var methodParameters = GetMethodParameters(property.Parameters, true);
|
||||
propertyName = $"this[{string.Join(", ", methodParameters)}]";
|
||||
}
|
||||
|
||||
|
||||
str.AppendLine($" {propertyType} {propertyName} {getSet}");
|
||||
str.AppendLine();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Text;
|
||||
using ProxyInterfaceSourceGenerator.Extensions;
|
||||
|
||||
namespace ProxyInterfaceSourceGenerator.FileGenerators;
|
||||
|
||||
internal partial class ProxyClassesGenerator
|
||||
{
|
||||
private string GenerateMapperConfigurationForMapster()
|
||||
{
|
||||
var str = new StringBuilder();
|
||||
|
||||
foreach (var replacedType in Context.ReplacedTypes)
|
||||
{
|
||||
TryFindProxyDataByTypeName(replacedType.Key, out var fullTypeName);
|
||||
var classNameProxy = $"{fullTypeName!.Namespace}.{fullTypeName.ShortTypeName}Proxy";
|
||||
|
||||
var instance = $"instance{(replacedType.Key + replacedType.Value).GetDeterministicHashCodeAsString()}";
|
||||
var proxy = $"proxy{(replacedType.Value + replacedType.Key).GetDeterministicHashCodeAsString()}";
|
||||
|
||||
str.AppendLine($" Mapster.TypeAdapterConfig<{replacedType.Key}, {replacedType.Value}>.NewConfig().ConstructUsing({instance} => new {classNameProxy}({instance}));");
|
||||
str.AppendLine($" Mapster.TypeAdapterConfig<{replacedType.Value}, {replacedType.Key}>.NewConfig().MapWith({proxy} => (({classNameProxy}) {proxy})._Instance);");
|
||||
str.AppendLine();
|
||||
}
|
||||
|
||||
return str.ToString();
|
||||
}
|
||||
}
|
||||
@@ -39,30 +39,7 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
var className = targetClassSymbol.Symbol.ResolveProxyClassName();
|
||||
var constructorName = $"{targetClassSymbol.Symbol.Name}Proxy";
|
||||
|
||||
var extendsProxyClasses = new List<ProxyData>();
|
||||
foreach (var baseType in targetClassSymbol.BaseTypes)
|
||||
{
|
||||
var candidate = Context.Candidates.Values.FirstOrDefault(ci => ci.FullRawTypeName == baseType.ToString());
|
||||
if (candidate is not null)
|
||||
{
|
||||
extendsProxyClasses.Add(candidate);
|
||||
break;
|
||||
}
|
||||
|
||||
// Try to find with usings
|
||||
foreach (var @using in pd.Usings)
|
||||
{
|
||||
candidate = Context.Candidates.Values.FirstOrDefault(ci => $"{@using}.{ci.FullRawTypeName}" == baseType.ToString());
|
||||
if (candidate is not null)
|
||||
{
|
||||
// Update the FullRawTypeName
|
||||
candidate.FullRawTypeName = $"{@using}.{candidate.FullRawTypeName}";
|
||||
|
||||
extendsProxyClasses.Add(candidate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var extendsProxyClasses = GetExtendsProxyData(pd, targetClassSymbol);
|
||||
|
||||
fileData = new FileData(
|
||||
$"{targetClassSymbol.Symbol.GetFileName()}Proxy.g.cs",
|
||||
@@ -75,7 +52,7 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
private string CreateProxyClassCode(
|
||||
ProxyData pd,
|
||||
ClassSymbol targetClassSymbol,
|
||||
List<ProxyData> extendsProxyClasses,
|
||||
IReadOnlyList<ProxyData> extendsProxyClasses,
|
||||
string interfaceName,
|
||||
string className,
|
||||
string constructorName)
|
||||
@@ -84,7 +61,7 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
var extends = string.Empty;
|
||||
var @base = string.Empty;
|
||||
var @new = string.Empty;
|
||||
var instanceBaseDefinition = string.Empty;
|
||||
var instanceBaseDefinition = string.Empty;
|
||||
var instanceBaseSetter = string.Empty;
|
||||
|
||||
if (firstExtends is not null)
|
||||
@@ -98,17 +75,13 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
|
||||
var @abstract = string.Empty; // targetClassSymbol.Symbol.IsAbstract ? "abstract " : string.Empty;
|
||||
var properties = GeneratePublicProperties(targetClassSymbol, pd.ProxyBaseClasses);
|
||||
var methods = GeneratePublicMethods(targetClassSymbol, pd.ProxyBaseClasses, extendsProxyClasses);
|
||||
var methods = GeneratePublicMethods(targetClassSymbol, pd.ProxyBaseClasses);
|
||||
var events = GenerateEvents(targetClassSymbol, pd.ProxyBaseClasses);
|
||||
|
||||
var configurationForAutoMapper = string.Empty;
|
||||
var privateAutoMapper = string.Empty;
|
||||
var usingAutoMapper = string.Empty;
|
||||
var configurationForMapster = string.Empty;
|
||||
if (Context.ReplacedTypes.Any())
|
||||
{
|
||||
configurationForAutoMapper = GenerateMapperConfigurationForAutoMapper();
|
||||
privateAutoMapper = GeneratePrivateAutoMapper();
|
||||
usingAutoMapper = "using AutoMapper;";
|
||||
configurationForMapster = GenerateMapperConfigurationForMapster();
|
||||
}
|
||||
|
||||
return $@"//----------------------------------------------------------------------------------------
|
||||
@@ -122,7 +95,6 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
|
||||
{(SupportsNullable ? "#nullable enable" : string.Empty)}
|
||||
using System;
|
||||
{usingAutoMapper}
|
||||
|
||||
namespace {pd.Namespace}
|
||||
{{
|
||||
@@ -142,10 +114,8 @@ namespace {pd.Namespace}
|
||||
_Instance = instance;
|
||||
{instanceBaseSetter}
|
||||
|
||||
{configurationForAutoMapper}
|
||||
{configurationForMapster}
|
||||
}}
|
||||
|
||||
{privateAutoMapper}
|
||||
}}
|
||||
}}
|
||||
{(SupportsNullable ? "#nullable disable" : string.Empty)}";
|
||||
@@ -188,8 +158,8 @@ namespace {pd.Namespace}
|
||||
string set;
|
||||
if (isReplaced)
|
||||
{
|
||||
get = property.GetMethod != null ? $"get => _mapper.Map<{type}>({instancePropertyName}); " : string.Empty;
|
||||
set = property.SetMethod != null ? $"set => {instancePropertyName} = _mapper.Map<{property.Type}>(value); " : string.Empty;
|
||||
get = property.GetMethod != null ? $"get => Mapster.TypeAdapter.Adapt<{type}>({instancePropertyName}); " : string.Empty;
|
||||
set = property.SetMethod != null ? $"set => {instancePropertyName} = Mapster.TypeAdapter.Adapt<{property.Type}>(value); " : string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -204,7 +174,7 @@ namespace {pd.Namespace}
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
private string GeneratePublicMethods(ClassSymbol targetClassSymbol, bool proxyBaseClasses, List<ProxyData> extendsProxyClasses)
|
||||
private string GeneratePublicMethods(ClassSymbol targetClassSymbol, bool proxyBaseClasses)
|
||||
{
|
||||
var str = new StringBuilder();
|
||||
foreach (var method in MemberHelper.GetPublicMethods(targetClassSymbol, proxyBaseClasses))
|
||||
@@ -252,7 +222,7 @@ namespace {pd.Namespace}
|
||||
_ = GetParameterType(ps, out var isReplaced); // TODO : response is not used?
|
||||
if (isReplaced)
|
||||
{
|
||||
normalOrMap = $" = _mapper.Map<{ps.Type}>({ps.GetSanitizedName()})";
|
||||
normalOrMap = $" = Mapster.TypeAdapter.Adapt<{ps.Type}>({ps.GetSanitizedName()})";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +253,7 @@ namespace {pd.Namespace}
|
||||
var type = GetParameterType(ps, out var isReplaced);
|
||||
if (isReplaced)
|
||||
{
|
||||
normalOrMap = $" = _mapper.Map<{type}>({ps.GetSanitizedName()}_)";
|
||||
normalOrMap = $" = Mapster.TypeAdapter.Adapt<{type}>({ps.GetSanitizedName()}_)";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,7 +264,7 @@ namespace {pd.Namespace}
|
||||
{
|
||||
if (returnIsReplaced)
|
||||
{
|
||||
str.AppendLine($" return _mapper.Map<{returnTypeAsString}>({alternateReturnVariableName});");
|
||||
str.AppendLine($" return Mapster.TypeAdapter.Adapt<{returnTypeAsString}>({alternateReturnVariableName});");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+16
-17
@@ -9,7 +9,6 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
@@ -18,7 +17,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public new Microsoft.SharePoint.Client.ClientContext _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientRuntimeContext _InstanceClientRuntimeContext { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb Web { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>(_Instance.Web); }
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb Web { get => Mapster.TypeAdapter.Adapt<ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>(_Instance.Web); }
|
||||
|
||||
public Microsoft.SharePoint.Client.Site Site { get => _Instance.Site; }
|
||||
|
||||
@@ -54,23 +53,23 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance = instance;
|
||||
_InstanceClientRuntimeContext = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>().ConstructUsing(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.Web, ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>().ConstructUsing(instance_1865313808 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.WebProxy(instance_1865313808));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb, Microsoft.SharePoint.Client.Web>().ConstructUsing(proxy2115366516 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.WebProxy) proxy2115366516)._Instance);
|
||||
}).CreateMapper();
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>.NewConfig().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>.NewConfig().MapWith(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>.NewConfig().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>.NewConfig().MapWith(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>.NewConfig().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>.NewConfig().MapWith(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>.NewConfig().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>.NewConfig().MapWith(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.Web, ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>.NewConfig().ConstructUsing(instance_1865313808 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.WebProxy(instance_1865313808));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb, Microsoft.SharePoint.Client.Web>.NewConfig().MapWith(proxy2115366516 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.WebProxy) proxy2115366516)._Instance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+8
-12
@@ -9,7 +9,6 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
@@ -18,7 +17,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public Microsoft.SharePoint.Client.ClientObject _Instance { get; }
|
||||
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext Context { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>(_Instance.Context); }
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext Context { get => Mapster.TypeAdapter.Adapt<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>(_Instance.Context); }
|
||||
|
||||
public object Tag { get => _Instance.Tag; set => _Instance.Tag = value; }
|
||||
|
||||
@@ -28,7 +27,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public bool? ServerObjectIsNull { get => _Instance.ServerObjectIsNull; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject TypedObject { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>(_Instance.TypedObject); }
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject TypedObject { get => Mapster.TypeAdapter.Adapt<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>(_Instance.TypedObject); }
|
||||
|
||||
|
||||
|
||||
@@ -84,17 +83,14 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance = instance;
|
||||
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
}).CreateMapper();
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>.NewConfig().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>.NewConfig().MapWith(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>.NewConfig().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>.NewConfig().MapWith(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+13
-15
@@ -9,7 +9,6 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
@@ -78,7 +77,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public T CastTo<T>(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject obj) where T : Microsoft.SharePoint.Client.ClientObject
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientObject obj_ = _mapper.Map<Microsoft.SharePoint.Client.ClientObject>(obj);
|
||||
Microsoft.SharePoint.Client.ClientObject obj_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientObject>(obj);
|
||||
var result_366781530 = _Instance.CastTo<T>(obj_);
|
||||
return result_366781530;
|
||||
}
|
||||
@@ -146,21 +145,20 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance = instance;
|
||||
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>().ConstructUsing(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
}).CreateMapper();
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>.NewConfig().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>.NewConfig().MapWith(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>.NewConfig().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>.NewConfig().MapWith(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>.NewConfig().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>.NewConfig().MapWith(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>.NewConfig().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>.NewConfig().MapWith(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+10
-13
@@ -9,7 +9,6 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
@@ -18,7 +17,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public new Microsoft.SharePoint.Client.SecurableObject _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientObject _InstanceClientObject { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject FirstUniqueAncestorSecurableObject { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>(_Instance.FirstUniqueAncestorSecurableObject); }
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject FirstUniqueAncestorSecurableObject { get => Mapster.TypeAdapter.Adapt<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>(_Instance.FirstUniqueAncestorSecurableObject); }
|
||||
|
||||
public bool HasUniqueRoleAssignments { get => _Instance.HasUniqueRoleAssignments; }
|
||||
|
||||
@@ -47,19 +46,17 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance = instance;
|
||||
_InstanceClientObject = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
}).CreateMapper();
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>.NewConfig().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>.NewConfig().MapWith(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>.NewConfig().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>.NewConfig().MapWith(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>.NewConfig().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>.NewConfig().MapWith(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+29
-31
@@ -9,7 +9,6 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
@@ -292,7 +291,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public System.Uri WebUrlFromPageUrlDirect(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext context, System.Uri pageFullUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientContext>(context);
|
||||
System.Uri pageFullUrl_ = pageFullUrl;
|
||||
var result__258107370 = Microsoft.SharePoint.Client.Web.WebUrlFromPageUrlDirect(context_, pageFullUrl_);
|
||||
return result__258107370;
|
||||
@@ -300,7 +299,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public System.Uri WebUrlFromFolderUrlDirect(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext context, System.Uri folderFullUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientContext>(context);
|
||||
System.Uri folderFullUrl_ = folderFullUrl;
|
||||
var result_21992317 = Microsoft.SharePoint.Client.Web.WebUrlFromFolderUrlDirect(context_, folderFullUrl_);
|
||||
return result_21992317;
|
||||
@@ -330,7 +329,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
var result_2070260011 = Microsoft.SharePoint.Client.Web.CreateOrganizationSharingLink(context_, url_, isEditLink_);
|
||||
@@ -339,7 +338,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
bool removeAssociatedSharingLinkGroup_ = removeAssociatedSharingLinkGroup;
|
||||
@@ -348,7 +347,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string fileUrl_ = fileUrl;
|
||||
var result_654626020 = Microsoft.SharePoint.Client.Web.GetSharingLinkKind(context_, fileUrl_);
|
||||
return result_654626020;
|
||||
@@ -372,7 +371,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string pageFullUrl_ = pageFullUrl;
|
||||
var result__907059837 = Microsoft.SharePoint.Client.Web.GetWebUrlFromPageUrl(context_, pageFullUrl_);
|
||||
return result__907059837;
|
||||
@@ -465,7 +464,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.SharingResult ShareObject(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, string peoplePickerInput, string roleValue, int groupId, bool propagateAcl, bool sendEmail, bool includeAnonymousLinkInEmail, string emailSubject, string emailBody, bool useSimplifiedRoles)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
string peoplePickerInput_ = peoplePickerInput;
|
||||
string roleValue_ = roleValue;
|
||||
@@ -482,7 +481,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.SharingResult ForwardObjectLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, string peoplePickerInput, string emailSubject, string emailBody)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
string peoplePickerInput_ = peoplePickerInput;
|
||||
string emailSubject_ = emailSubject;
|
||||
@@ -493,7 +492,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.SharingResult UnshareObject(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
var result__823224569 = Microsoft.SharePoint.Client.Web.UnshareObject(context_, url_);
|
||||
return result__823224569;
|
||||
@@ -501,7 +500,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ObjectSharingSettings GetObjectSharingSettings(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string objectUrl, int groupId, bool useSimplifiedRoles)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string objectUrl_ = objectUrl;
|
||||
int groupId_ = groupId;
|
||||
bool useSimplifiedRoles_ = useSimplifiedRoles;
|
||||
@@ -511,7 +510,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> CreateAnonymousLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
var result__820192309 = Microsoft.SharePoint.Client.Web.CreateAnonymousLink(context_, url_, isEditLink_);
|
||||
@@ -520,7 +519,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> CreateAnonymousLinkWithExpiration(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, string expirationString)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
string expirationString_ = expirationString;
|
||||
@@ -530,14 +529,14 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public void DeleteAllAnonymousLinksForObject(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
Microsoft.SharePoint.Client.Web.DeleteAllAnonymousLinksForObject(context_, url_);
|
||||
}
|
||||
|
||||
public void DeleteAnonymousLinkForObject(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
bool removeAssociatedSharingLinkGroup_ = removeAssociatedSharingLinkGroup;
|
||||
@@ -695,7 +694,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public System.Collections.Generic.IList<Microsoft.SharePoint.Client.DocumentLibraryInformation> GetDocumentLibraries(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string webFullUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string webFullUrl_ = webFullUrl;
|
||||
var result_2078170246 = Microsoft.SharePoint.Client.Web.GetDocumentLibraries(context_, webFullUrl_);
|
||||
return result_2078170246;
|
||||
@@ -703,7 +702,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public System.Collections.Generic.IList<Microsoft.SharePoint.Client.DocumentLibraryInformation> GetDocumentAndMediaLibraries(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string webFullUrl, bool includePageLibraries)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string webFullUrl_ = webFullUrl;
|
||||
bool includePageLibraries_ = includePageLibraries;
|
||||
var result__431075153 = Microsoft.SharePoint.Client.Web.GetDocumentAndMediaLibraries(context_, webFullUrl_, includePageLibraries_);
|
||||
@@ -712,7 +711,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.DocumentLibraryInformation> DefaultDocumentLibraryUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string webUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = Mapster.TypeAdapter.Adapt<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string webUrl_ = webUrl;
|
||||
var result_1125717726 = Microsoft.SharePoint.Client.Web.DefaultDocumentLibraryUrl(context_, webUrl_);
|
||||
return result_1125717726;
|
||||
@@ -921,21 +920,20 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance = instance;
|
||||
_InstanceSecurableObject = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>().ConstructUsing(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
}).CreateMapper();
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>.NewConfig().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>.NewConfig().MapWith(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>.NewConfig().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>.NewConfig().MapWith(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>.NewConfig().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>.NewConfig().MapWith(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
|
||||
Mapster.TypeAdapterConfig<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>.NewConfig().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>.NewConfig().MapWith(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
-3
@@ -10,7 +10,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
public partial class HumanProxy : IHuman
|
||||
@@ -35,8 +34,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
public partial interface IHuman
|
||||
{
|
||||
ProxyInterfaceSourceGeneratorTests.Source.Human _Instance { get; }
|
||||
|
||||
bool IsAlive { get; set; }
|
||||
|
||||
string GetterOnly { get; }
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
public partial interface IPerson
|
||||
{
|
||||
new ProxyInterfaceSourceGeneratorTests.Source.Person _Instance { get; }
|
||||
|
||||
ProxyInterfaceSourceGeneratorTests.Source.MyStruct this[int i] { get; set; }
|
||||
|
||||
ProxyInterfaceSourceGeneratorTests.Source.MyStruct this[int i, string s] { get; set; }
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
public partial interface IPersonExtends
|
||||
{
|
||||
ProxyInterfaceSourceGeneratorTests.Source.PersonExtends _Instance { get; }
|
||||
|
||||
string StaticString { get; set; }
|
||||
|
||||
string Name { get; set; }
|
||||
|
||||
-3
@@ -10,7 +10,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
public partial class PersonExtendsProxy : IPersonExtends
|
||||
@@ -122,8 +121,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+7
-13
@@ -9,15 +9,13 @@
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
{
|
||||
public partial class PersonProxy : ProxyInterfaceSourceGeneratorTests.Source.HumanProxy, IPerson
|
||||
{
|
||||
public new ProxyInterfaceSourceGeneratorTests.Source.Person _Instance { get; }
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.Human _InstanceBase { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.Human _InstanceHuman { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.MyStruct this[int i] { get => _Instance[i]; set => _Instance[i] = value; }
|
||||
|
||||
@@ -35,9 +33,9 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
|
||||
public System.Collections.Generic.IList<ProxyInterfaceSourceGeneratorTests.Source.IHuman> AddHuman(ProxyInterfaceSourceGeneratorTests.Source.IHuman h)
|
||||
{
|
||||
ProxyInterfaceSourceGeneratorTests.Source.Human h_ = _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.Human>(h);
|
||||
ProxyInterfaceSourceGeneratorTests.Source.Human h_ = Mapster.TypeAdapter.Adapt<ProxyInterfaceSourceGeneratorTests.Source.Human>(h);
|
||||
var result_907493286 = _Instance.AddHuman(h_);
|
||||
return _mapper.Map<System.Collections.Generic.IList<ProxyInterfaceSourceGeneratorTests.Source.IHuman>>(result_907493286);
|
||||
return Mapster.TypeAdapter.Adapt<System.Collections.Generic.IList<ProxyInterfaceSourceGeneratorTests.Source.IHuman>>(result_907493286);
|
||||
}
|
||||
|
||||
public void Void()
|
||||
@@ -153,17 +151,13 @@ namespace ProxyInterfaceSourceGeneratorTests.Source
|
||||
public PersonProxy(ProxyInterfaceSourceGeneratorTests.Source.Person instance) : base(instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
_InstanceBase = instance;
|
||||
_InstanceHuman = instance;
|
||||
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.Human, ProxyInterfaceSourceGeneratorTests.Source.IHuman>.NewConfig().ConstructUsing(instance_1903550791 => new ProxyInterfaceSourceGeneratorTests.Source.HumanProxy(instance_1903550791));
|
||||
Mapster.TypeAdapterConfig<ProxyInterfaceSourceGeneratorTests.Source.IHuman, ProxyInterfaceSourceGeneratorTests.Source.Human>.NewConfig().MapWith(proxy1075308949 => ((ProxyInterfaceSourceGeneratorTests.Source.HumanProxy) proxy1075308949)._Instance);
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.Human, ProxyInterfaceSourceGeneratorTests.Source.IHuman>().ConstructUsing(instance_1903550791 => new ProxyInterfaceSourceGeneratorTests.Source.HumanProxy(instance_1903550791));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.IHuman, ProxyInterfaceSourceGeneratorTests.Source.Human>().ConstructUsing(proxy1075308949 => ((ProxyInterfaceSourceGeneratorTests.Source.HumanProxy) proxy1075308949)._Instance);
|
||||
}).CreateMapper();
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface IClientContext
|
||||
{
|
||||
new Microsoft.SharePoint.Client.ClientContext _Instance { get; }
|
||||
|
||||
ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb Web { get; }
|
||||
|
||||
Microsoft.SharePoint.Client.Site Site { get; }
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface IClientObject
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientObject _Instance { get; }
|
||||
|
||||
ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext Context { get; }
|
||||
|
||||
object Tag { get; set; }
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface IClientRuntimeContext
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext _Instance { get; }
|
||||
|
||||
string Url { get; }
|
||||
|
||||
string ApplicationName { get; set; }
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface ISecurableObject
|
||||
{
|
||||
new Microsoft.SharePoint.Client.SecurableObject _Instance { get; }
|
||||
|
||||
ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject FirstUniqueAncestorSecurableObject { get; }
|
||||
|
||||
bool HasUniqueRoleAssignments { get; }
|
||||
|
||||
+2
@@ -14,6 +14,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface IWeb
|
||||
{
|
||||
new Microsoft.SharePoint.Client.Web _Instance { get; }
|
||||
|
||||
string AccessRequestListUrl { get; }
|
||||
|
||||
string AccessRequestSiteDescription { get; }
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="11.0.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.7.0" />
|
||||
<PackageReference Include="Mapster" Version="7.3.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
|
||||
<PackageReference Include="Moq" Version="4.18.2" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.10.0" />
|
||||
|
||||
Reference in New Issue
Block a user