Fixed generated code when a class extends multiple classes (#38)
* . * . * pnp * ok * compiles * ? * e * set * .ToArray() * n * ... * ok * pnp * . * . * mapster
This commit is contained in:
@@ -28,6 +28,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumerViaNu
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceSourceGeneratorTests", "tests\ProxyInterfaceSourceGeneratorTests\ProxyInterfaceSourceGeneratorTests.csproj", "{1BDB9046-D6D1-4FB4-AAB5-F24E33EEAE0A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxyInterfaceConsumerForPnP", "src-examples\ProxyInterfaceConsumerForPnP\ProxyInterfaceConsumerForPnP.csproj", "{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -57,6 +59,12 @@ Global
|
||||
{1BDB9046-D6D1-4FB4-AAB5-F24E33EEAE0A}.DebugAttach|Any CPU.Build.0 = DebugAttach|Any CPU
|
||||
{1BDB9046-D6D1-4FB4-AAB5-F24E33EEAE0A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1BDB9046-D6D1-4FB4-AAB5-F24E33EEAE0A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}.DebugAttach|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}.DebugAttach|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -66,6 +74,7 @@ Global
|
||||
{7E0A10EE-CCC3-4281-9541-B0AF037D3DF9} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
|
||||
{6BEBFEB9-635F-44A2-949C-15DDDF0B7740} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
|
||||
{1BDB9046-D6D1-4FB4-AAB5-F24E33EEAE0A} = {19009F5B-3267-45E2-A8B6-89F2AB47D72C}
|
||||
{5F7DA2C5-B908-4B57-9F5F-BADF1216D89C} = {38BA087F-EDA1-4F8A-A140-85B84791B815}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {585F071D-051D-441C-9C6B-226D9E15A1F5}
|
||||
|
||||
@@ -92,3 +92,6 @@ IPerson p = new PersonProxy(new Person());
|
||||
p.Name = "test";
|
||||
p.HelloWorld("stef");
|
||||
```
|
||||
|
||||
# References
|
||||
- https://route2roslyn.netlify.app/symbols-for-dummies/
|
||||
@@ -1,10 +0,0 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(ClientContext))]
|
||||
public partial interface IClientContext
|
||||
{
|
||||
// public virtual void X();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
using AutoMapper;
|
||||
using DifferentNamespace;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using Microsoft.SharePoint.Client;
|
||||
using ProxyInterfaceConsumer.PnP;
|
||||
using DifferentNamespace;
|
||||
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
@@ -17,11 +14,6 @@ namespace ProxyInterfaceConsumer
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
var cp = new ClientContextProxy(new ClientContext("x"));
|
||||
cp.ExecuteQuery();
|
||||
var webP = cp.Web;
|
||||
|
||||
|
||||
var t = new TestProxy(new Test());
|
||||
|
||||
IPersonT<int> pT = new PersonTProxy<int>(new PersonT<int>());
|
||||
|
||||
@@ -1,42 +1,29 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<LangVersion>9</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<OutputType>Exe</OutputType>
|
||||
<LangVersion>9</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="IPersonTT.cs" />
|
||||
<Compile Remove="PersonTT.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="IPersonTT.cs" />
|
||||
<Compile Remove="PersonTT.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.10.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.8.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="3.10.0" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ProxyInterfaceSourceGenerator\ProxyInterfaceSourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="PnP\IWeb.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientContext.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientRuntimeContext.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ProxyInterfaceSourceGenerator\ProxyInterfaceSourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
// [ProxyInterfaceGenerator.Proxy(typeof(Microsoft.CodeAnalysis.GeneratorExecutionContext))]
|
||||
public partial interface IGeneratorExecutionContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace ProxyInterfaceConsumer
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(ProxyInterfaceConsumer.PersonTT<,>))]
|
||||
public partial interface IPersonTT<T1, T2>
|
||||
where T1 : struct
|
||||
where T2 : class, new()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientObject))]
|
||||
public partial interface IClientObject
|
||||
{
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,6 +3,6 @@ namespace ProxyInterfaceConsumer.PnP
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.ClientRuntimeContext))]
|
||||
public partial interface IClientRuntimeContext
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.SecurableObject))]
|
||||
public partial interface ISecurableObject : IClientObject
|
||||
{
|
||||
// public virtual void X();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
namespace ProxyInterfaceConsumer.PnP
|
||||
{
|
||||
[ProxyInterfaceGenerator.Proxy(typeof(Microsoft.SharePoint.Client.Web))]
|
||||
public partial interface IWeb
|
||||
public partial interface IWeb: ISecurableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
using ProxyInterfaceConsumer.PnP;
|
||||
|
||||
namespace ProxyInterfaceConsumerForPnP
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
var cp = new ClientContextProxy(new ClientContext("https://heyenrath.nl"));
|
||||
cp.Test();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.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="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>
|
||||
</PackageReference>
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ProxyInterfaceSourceGenerator\ProxyInterfaceSourceGenerator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="PnP\ISecurableObject.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientObject.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IWeb.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientContext.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
<Compile Update="PnP\IClientRuntimeContext.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -26,4 +26,9 @@ internal static class StringExtensions
|
||||
return result.ToString().Replace('-', '_');
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLastPart(this string fullTypeName)
|
||||
{
|
||||
return fullTypeName.Split('.').LastOrDefault() ?? fullTypeName;
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,13 @@ internal abstract class BaseGenerator
|
||||
|
||||
protected bool TryFindProxyDataByTypeName(string type, [NotNullWhen(true)] out ProxyData? proxyData)
|
||||
{
|
||||
proxyData = Context.CandidateInterfaces.Values.FirstOrDefault(x => x.FullRawTypeName == type);
|
||||
proxyData = Context.Candidates.Values.FirstOrDefault(x => x.FullRawTypeName == type);
|
||||
if (proxyData != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach (var ci in Context.CandidateInterfaces.Values)
|
||||
foreach (var ci in Context.Candidates.Values)
|
||||
{
|
||||
foreach (var u in ci.Usings)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ internal class PartialInterfacesGenerator : BaseGenerator, IFilesGenerator
|
||||
|
||||
public IEnumerable<FileData> GenerateFiles()
|
||||
{
|
||||
foreach (var ci in Context.CandidateInterfaces)
|
||||
foreach (var ci in Context.Candidates)
|
||||
{
|
||||
if (TryGenerateFile(ci.Key, ci.Value, out var file))
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ internal partial class ProxyClassesGenerator
|
||||
|
||||
str.AppendLine($" cfg.CreateMap<{replacedType.Key}, {replacedType.Value}>().ConstructUsing({instance} => new {classNameProxy}({instance}));");
|
||||
str.AppendLine($" cfg.CreateMap<{replacedType.Value}, {replacedType.Key}>().ConstructUsing({proxy} => (({classNameProxy}) {proxy})._Instance);");
|
||||
str.AppendLine();
|
||||
}
|
||||
str.AppendLine(" }).CreateMapper();");
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
|
||||
public IEnumerable<FileData> GenerateFiles()
|
||||
{
|
||||
foreach (var ci in Context.CandidateInterfaces)
|
||||
foreach (var ci in Context.Candidates)
|
||||
{
|
||||
if (TryGenerateFile(ci.Value, out var file))
|
||||
{
|
||||
@@ -39,12 +39,30 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
var className = targetClassSymbol.Symbol.ResolveProxyClassName();
|
||||
var constructorName = $"{targetClassSymbol.Symbol.Name}Proxy";
|
||||
|
||||
var extendsProxyClasses = targetClassSymbol.BaseTypes
|
||||
.Join(
|
||||
Context.CandidateInterfaces.Values,
|
||||
namedTypeSymbol => namedTypeSymbol.ToString(),
|
||||
proxyData => proxyData.FullRawTypeName, (_, proxyData) => proxyData
|
||||
).ToList();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fileData = new FileData(
|
||||
$"{targetClassSymbol.Symbol.GetFileName()}Proxy.g.cs",
|
||||
@@ -62,12 +80,23 @@ internal partial class ProxyClassesGenerator : BaseGenerator, IFilesGenerator
|
||||
string className,
|
||||
string constructorName)
|
||||
{
|
||||
var extends = extendsProxyClasses.Select(e => $"{e.Namespace}.{e.ShortTypeName}Proxy, ").FirstOrDefault() ?? string.Empty;
|
||||
var @base = extendsProxyClasses.Any() ? " : base(instance)" : string.Empty;
|
||||
var @new = extendsProxyClasses.Any() ? "new " : string.Empty;
|
||||
var instanceBaseDefinition = extendsProxyClasses.Any() ? $"public {extendsProxyClasses[0].FullRawTypeName} _InstanceBase {{ get; }}\r\n" : string.Empty;
|
||||
var instanceBaseSet = extendsProxyClasses.Any() ? "_InstanceBase = instance;" : string.Empty;
|
||||
var firstExtends = extendsProxyClasses.FirstOrDefault();
|
||||
var extends = string.Empty;
|
||||
var @base = string.Empty;
|
||||
var @new = string.Empty;
|
||||
var instanceBaseDefinition = string.Empty;
|
||||
var instanceBaseSetter = string.Empty;
|
||||
|
||||
if (firstExtends is not null)
|
||||
{
|
||||
extends = $"{firstExtends.Namespace}.{firstExtends.ShortTypeName}Proxy, ";
|
||||
@base = " : base(instance)";
|
||||
@new = "new ";
|
||||
instanceBaseDefinition = $"public {firstExtends.FullRawTypeName} _Instance{firstExtends.FullRawTypeName.GetLastPart()} {{ get; }}";
|
||||
instanceBaseSetter = $"_Instance{firstExtends.FullRawTypeName.GetLastPart()} = instance;";
|
||||
}
|
||||
|
||||
var @abstract = string.Empty; // targetClassSymbol.Symbol.IsAbstract ? "abstract " : string.Empty;
|
||||
var properties = GeneratePublicProperties(targetClassSymbol, pd.ProxyBaseClasses);
|
||||
var methods = GeneratePublicMethods(targetClassSymbol, pd.ProxyBaseClasses, extendsProxyClasses);
|
||||
var events = GenerateEvents(targetClassSymbol, pd.ProxyBaseClasses);
|
||||
@@ -97,7 +126,7 @@ using System;
|
||||
|
||||
namespace {pd.Namespace}
|
||||
{{
|
||||
public partial class {className} : {extends}{interfaceName}
|
||||
public {@abstract}partial class {className} : {extends}{interfaceName}
|
||||
{{
|
||||
public {@new}{targetClassSymbol.Symbol} _Instance {{ get; }}
|
||||
{instanceBaseDefinition}
|
||||
@@ -111,7 +140,7 @@ namespace {pd.Namespace}
|
||||
public {constructorName}({targetClassSymbol} instance){@base}
|
||||
{{
|
||||
_Instance = instance;
|
||||
{instanceBaseSet}
|
||||
{instanceBaseSetter}
|
||||
|
||||
{configurationForAutoMapper}
|
||||
}}
|
||||
@@ -220,7 +249,7 @@ namespace {pd.Namespace}
|
||||
}
|
||||
else
|
||||
{
|
||||
var type = GetParameterType(ps, out var isReplaced);
|
||||
_ = GetParameterType(ps, out var isReplaced); // TODO : response is not used?
|
||||
if (isReplaced)
|
||||
{
|
||||
normalOrMap = $" = _mapper.Map<{ps.Type}>({ps.GetSanitizedName()})";
|
||||
|
||||
@@ -9,7 +9,7 @@ internal record Context
|
||||
|
||||
// public List<ContextData> GeneratedData { get; } = new List<ContextData>();
|
||||
|
||||
public IDictionary<InterfaceDeclarationSyntax, ProxyData> CandidateInterfaces { get; init; } = default!;
|
||||
public IDictionary<InterfaceDeclarationSyntax, ProxyData> Candidates { get; init; } = default!;
|
||||
|
||||
public Dictionary<string, string> ReplacedTypes { get; } = new();
|
||||
}
|
||||
@@ -5,7 +5,7 @@ internal class ProxyData
|
||||
public string Namespace { get; init; }
|
||||
public string ShortInterfaceName { get; init; }
|
||||
public string FullInterfaceName { get; init; }
|
||||
public string FullRawTypeName { get; init; }
|
||||
public string FullRawTypeName { get; set; }
|
||||
public string ShortTypeName { get; init; }
|
||||
public string FullTypeName { get; init; }
|
||||
public List<string> Usings { get; init; }
|
||||
|
||||
@@ -63,7 +63,7 @@ internal class ProxyInterfaceCodeGenerator : ISourceGenerator
|
||||
var context = new Context
|
||||
{
|
||||
GeneratorExecutionContext = ctx,
|
||||
CandidateInterfaces = receiver.CandidateInterfaces
|
||||
Candidates = receiver.CandidateInterfaces
|
||||
};
|
||||
|
||||
var attributeData = _proxyAttributeGenerator.GenerateFile();
|
||||
@@ -75,7 +75,7 @@ internal class ProxyInterfaceCodeGenerator : ISourceGenerator
|
||||
var context = new Context
|
||||
{
|
||||
GeneratorExecutionContext = ctx,
|
||||
CandidateInterfaces = receiver.CandidateInterfaces
|
||||
Candidates = receiver.CandidateInterfaces
|
||||
};
|
||||
|
||||
var partialInterfacesGenerator = new PartialInterfacesGenerator(context, supportsNullable);
|
||||
@@ -90,7 +90,7 @@ internal class ProxyInterfaceCodeGenerator : ISourceGenerator
|
||||
var context = new Context
|
||||
{
|
||||
GeneratorExecutionContext = ctx,
|
||||
CandidateInterfaces = receiver.CandidateInterfaces
|
||||
Candidates = receiver.CandidateInterfaces
|
||||
};
|
||||
|
||||
var proxyClassesGenerator = new ProxyClassesGenerator(context, supportsNullable);
|
||||
|
||||
@@ -77,7 +77,7 @@ internal class ProxySyntaxReceiver : ISyntaxReceiver
|
||||
{
|
||||
Namespace = ns,
|
||||
ShortInterfaceName = interfaceDeclarationSyntax.Identifier.ToString(),
|
||||
FullInterfaceName = CreateFullBuilderClassName(ns, interfaceDeclarationSyntax), // $"{ns}.{interfaceDeclarationSyntax.Identifier}",
|
||||
FullInterfaceName = CreateFullInterfaceName(ns, interfaceDeclarationSyntax), // $"{ns}.{interfaceDeclarationSyntax.Identifier}",
|
||||
FullRawTypeName = rawTypeName,
|
||||
ShortTypeName = ConvertTypeName(rawTypeName).Split('.').Last(),
|
||||
FullTypeName = ConvertTypeName(rawTypeName),
|
||||
@@ -95,7 +95,7 @@ internal class ProxySyntaxReceiver : ISyntaxReceiver
|
||||
$"{typeName.Replace("<", string.Empty).Replace(">", string.Empty).Replace(",", string.Empty).Trim()}`{typeName.Count(c => c == ',') + 1}";
|
||||
}
|
||||
|
||||
private static string CreateFullBuilderClassName(string ns, BaseTypeDeclarationSyntax classDeclarationSyntax)
|
||||
private static string CreateFullInterfaceName(string ns, BaseTypeDeclarationSyntax classDeclarationSyntax)
|
||||
{
|
||||
return !string.IsNullOrEmpty(ns) ? $"{ns}.{classDeclarationSyntax.Identifier}" : classDeclarationSyntax.Identifier.ToString();
|
||||
}
|
||||
|
||||
+4
-3
@@ -16,8 +16,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public partial class ClientContextProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy, IClientContext
|
||||
{
|
||||
public new Microsoft.SharePoint.Client.ClientContext _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientRuntimeContext _InstanceBase { get; }
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientRuntimeContext _InstanceClientRuntimeContext { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb Web { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>(_Instance.Web); }
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public ClientContextProxy(Microsoft.SharePoint.Client.ClientContext instance) : base(instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
_InstanceBase = instance;
|
||||
_InstanceClientRuntimeContext = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
@@ -61,6 +60,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
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));
|
||||
|
||||
+2
@@ -152,6 +152,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
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();
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial class SecurableObjectProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy, ISecurableObject
|
||||
{
|
||||
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 bool HasUniqueRoleAssignments { get => _Instance.HasUniqueRoleAssignments; }
|
||||
|
||||
public Microsoft.SharePoint.Client.RoleAssignmentCollection RoleAssignments { get => _Instance.RoleAssignments; }
|
||||
|
||||
|
||||
|
||||
public virtual void ResetRoleInheritance()
|
||||
{
|
||||
_Instance.ResetRoleInheritance();
|
||||
}
|
||||
|
||||
public virtual void BreakRoleInheritance(bool copyRoleAssignments, bool clearSubscopes)
|
||||
{
|
||||
bool copyRoleAssignments_ = copyRoleAssignments;
|
||||
bool clearSubscopes_ = clearSubscopes;
|
||||
_Instance.BreakRoleInheritance(copyRoleAssignments_, clearSubscopes_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public SecurableObjectProxy(Microsoft.SharePoint.Client.SecurableObject instance) : base(instance)
|
||||
{
|
||||
_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();
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+131
-104
@@ -13,16 +13,17 @@ using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial class WebProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy, IWeb
|
||||
public partial class WebProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy, IWeb
|
||||
{
|
||||
public new Microsoft.SharePoint.Client.Web _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientObject _InstanceBase { get; }
|
||||
|
||||
public Microsoft.SharePoint.Client.SecurableObject _InstanceSecurableObject { get; }
|
||||
|
||||
public string AccessRequestListUrl { get => _Instance.AccessRequestListUrl; }
|
||||
|
||||
public string AccessRequestSiteDescription { get => _Instance.AccessRequestSiteDescription; }
|
||||
|
||||
public string Acronym { get => _Instance.Acronym; }
|
||||
|
||||
public Microsoft.SharePoint.Client.AlertCollection Alerts { get => _Instance.Alerts; }
|
||||
|
||||
public bool AllowAutomaticASPXPageIndexing { get => _Instance.AllowAutomaticASPXPageIndexing; set => _Instance.AllowAutomaticASPXPageIndexing = value; }
|
||||
@@ -87,6 +88,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public string Description { get => _Instance.Description; set => _Instance.Description = value; }
|
||||
|
||||
public string DescriptionForExistingLanguage { get => _Instance.DescriptionForExistingLanguage; set => _Instance.DescriptionForExistingLanguage = value; }
|
||||
|
||||
public Microsoft.SharePoint.Client.UserResource DescriptionResource { get => _Instance.DescriptionResource; }
|
||||
|
||||
public System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> DescriptionTranslations { get => _Instance.DescriptionTranslations; set => _Instance.DescriptionTranslations = value; }
|
||||
@@ -137,6 +140,12 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public System.Guid Id { get => _Instance.Id; }
|
||||
|
||||
public bool IsEduClass { get => _Instance.IsEduClass; }
|
||||
|
||||
public bool IsEduClassProvisionChecked { get => _Instance.IsEduClassProvisionChecked; }
|
||||
|
||||
public bool IsEduClassProvisionPending { get => _Instance.IsEduClassProvisionPending; }
|
||||
|
||||
public bool IsHomepageModernized { get => _Instance.IsHomepageModernized; }
|
||||
|
||||
public bool IsMultilingual { get => _Instance.IsMultilingual; set => _Instance.IsMultilingual = value; }
|
||||
@@ -247,6 +256,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public string Title { get => _Instance.Title; set => _Instance.Title = value; }
|
||||
|
||||
public string TitleForExistingLanguage { get => _Instance.TitleForExistingLanguage; set => _Instance.TitleForExistingLanguage = value; }
|
||||
|
||||
public Microsoft.SharePoint.Client.UserResource TitleResource { get => _Instance.TitleResource; }
|
||||
|
||||
public System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> TitleTranslations { get => _Instance.TitleTranslations; set => _Instance.TitleTranslations = value; }
|
||||
@@ -317,6 +328,105 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance.CreateDefaultAssociatedGroups(userLogin_, userLogin2_, groupNameSeed_);
|
||||
}
|
||||
|
||||
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);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
var result_2070260011 = Microsoft.SharePoint.Client.Web.CreateOrganizationSharingLink(context_, url_, isEditLink_);
|
||||
return result_2070260011;
|
||||
}
|
||||
|
||||
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);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
bool removeAssociatedSharingLinkGroup_ = removeAssociatedSharingLinkGroup;
|
||||
Microsoft.SharePoint.Client.Web.DestroyOrganizationSharingLink(context_, url_, isEditLink_, removeAssociatedSharingLinkGroup_);
|
||||
}
|
||||
|
||||
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);
|
||||
string fileUrl_ = fileUrl;
|
||||
var result_654626020 = Microsoft.SharePoint.Client.Web.GetSharingLinkKind(context_, fileUrl_);
|
||||
return result_654626020;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl)
|
||||
{
|
||||
string linkUrl_ = linkUrl;
|
||||
var result__2107757018 = _Instance.GetSharingLinkData(linkUrl_);
|
||||
return result__2107757018;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size)
|
||||
{
|
||||
string fileName_ = fileName;
|
||||
string progId_ = progId;
|
||||
Microsoft.SharePoint.Client.Utilities.IconSize size_ = size;
|
||||
var result_384589064 = _Instance.MapToIcon(fileName_, progId_, size_);
|
||||
return result_384589064;
|
||||
}
|
||||
|
||||
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);
|
||||
string pageFullUrl_ = pageFullUrl;
|
||||
var result__907059837 = Microsoft.SharePoint.Client.Web.GetWebUrlFromPageUrl(context_, pageFullUrl_);
|
||||
return result__907059837;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
string serviceToken_ = serviceToken;
|
||||
var result__117534630 = _Instance.RegisterPushNotificationSubscriber(deviceAppInstanceId_, serviceToken_);
|
||||
return result__117534630;
|
||||
}
|
||||
|
||||
public void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
_Instance.UnregisterPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs)
|
||||
{
|
||||
string customArgs_ = customArgs;
|
||||
var result_144086076 = _Instance.GetPushNotificationSubscribersByArgs(customArgs_);
|
||||
return result_144086076;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName)
|
||||
{
|
||||
string userName_ = userName;
|
||||
var result__1280834962 = _Instance.GetPushNotificationSubscribersByUser(userName_);
|
||||
return result__1280834962;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result__1309404561 = _Instance.DoesPushNotificationSubscriberExist(deviceAppInstanceId_);
|
||||
return result__1309404561;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result_1696633571 = _Instance.GetPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
return result_1696633571;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.User GetSiteUserIncludingDeletedByPuid(string puid)
|
||||
{
|
||||
string puid_ = puid;
|
||||
var result__1448181221 = _Instance.GetSiteUserIncludingDeletedByPuid(puid_);
|
||||
return result__1448181221;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.User GetUserById(int userId)
|
||||
{
|
||||
int userId_ = userId;
|
||||
@@ -434,96 +544,26 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
Microsoft.SharePoint.Client.Web.DeleteAnonymousLinkForObject(context_, url_, isEditLink_, removeAssociatedSharingLinkGroup_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink)
|
||||
public Microsoft.SharePoint.Client.ListCollection GetLists(Microsoft.SharePoint.Client.GetListsParameters getListsParams)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
var result_2070260011 = Microsoft.SharePoint.Client.Web.CreateOrganizationSharingLink(context_, url_, isEditLink_);
|
||||
return result_2070260011;
|
||||
Microsoft.SharePoint.Client.GetListsParameters getListsParams_ = getListsParams;
|
||||
var result_1293372807 = _Instance.GetLists(getListsParams_);
|
||||
return result_1293372807;
|
||||
}
|
||||
|
||||
public void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup)
|
||||
public Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
bool removeAssociatedSharingLinkGroup_ = removeAssociatedSharingLinkGroup;
|
||||
Microsoft.SharePoint.Client.Web.DestroyOrganizationSharingLink(context_, url_, isEditLink_, removeAssociatedSharingLinkGroup_);
|
||||
uint lcid_ = lcid;
|
||||
bool doIncludeCrossLanguage_ = doIncludeCrossLanguage;
|
||||
var result__1052443476 = _Instance.GetAvailableWebTemplates(lcid_, doIncludeCrossLanguage_);
|
||||
return result__1052443476;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl)
|
||||
public Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string fileUrl_ = fileUrl;
|
||||
var result_654626020 = Microsoft.SharePoint.Client.Web.GetSharingLinkKind(context_, fileUrl_);
|
||||
return result_654626020;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl)
|
||||
{
|
||||
string linkUrl_ = linkUrl;
|
||||
var result__2107757018 = _Instance.GetSharingLinkData(linkUrl_);
|
||||
return result__2107757018;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size)
|
||||
{
|
||||
string fileName_ = fileName;
|
||||
string progId_ = progId;
|
||||
Microsoft.SharePoint.Client.Utilities.IconSize size_ = size;
|
||||
var result_384589064 = _Instance.MapToIcon(fileName_, progId_, size_);
|
||||
return result_384589064;
|
||||
}
|
||||
|
||||
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);
|
||||
string pageFullUrl_ = pageFullUrl;
|
||||
var result__907059837 = Microsoft.SharePoint.Client.Web.GetWebUrlFromPageUrl(context_, pageFullUrl_);
|
||||
return result__907059837;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
string serviceToken_ = serviceToken;
|
||||
var result__117534630 = _Instance.RegisterPushNotificationSubscriber(deviceAppInstanceId_, serviceToken_);
|
||||
return result__117534630;
|
||||
}
|
||||
|
||||
public void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
_Instance.UnregisterPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs)
|
||||
{
|
||||
string customArgs_ = customArgs;
|
||||
var result_144086076 = _Instance.GetPushNotificationSubscribersByArgs(customArgs_);
|
||||
return result_144086076;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName)
|
||||
{
|
||||
string userName_ = userName;
|
||||
var result__1280834962 = _Instance.GetPushNotificationSubscribersByUser(userName_);
|
||||
return result__1280834962;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result__1309404561 = _Instance.DoesPushNotificationSubscriberExist(deviceAppInstanceId_);
|
||||
return result__1309404561;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result_1696633571 = _Instance.GetPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
return result_1696633571;
|
||||
int typeCatalog_ = typeCatalog;
|
||||
var result__1458409307 = _Instance.GetCatalog(typeCatalog_);
|
||||
return result__1458409307;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.RecycleBinItemCollection GetRecycleBinItems(string pagingInfo, int rowLimit, bool isAscending, Microsoft.SharePoint.Client.RecycleBinOrderBy orderBy, Microsoft.SharePoint.Client.RecycleBinItemState itemState)
|
||||
@@ -620,19 +660,9 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
return result_127789125;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage)
|
||||
public void Update()
|
||||
{
|
||||
uint lcid_ = lcid;
|
||||
bool doIncludeCrossLanguage_ = doIncludeCrossLanguage;
|
||||
var result__1052443476 = _Instance.GetAvailableWebTemplates(lcid_, doIncludeCrossLanguage_);
|
||||
return result__1052443476;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog)
|
||||
{
|
||||
int typeCatalog_ = typeCatalog;
|
||||
var result__1458409307 = _Instance.GetCatalog(typeCatalog_);
|
||||
return result__1458409307;
|
||||
_Instance.Update();
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.View GetViewFromUrl(string listUrl)
|
||||
@@ -769,11 +799,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance.DeleteObject();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
_Instance.Update();
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> PageContextInfo(bool includeODBSettings, bool emitNavigationInfo)
|
||||
{
|
||||
bool includeODBSettings_ = includeODBSettings;
|
||||
@@ -894,7 +919,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public WebProxy(Microsoft.SharePoint.Client.Web instance) : base(instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
_InstanceBase = instance;
|
||||
_InstanceSecurableObject = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
@@ -902,6 +927,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
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();
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface ISecurableObject
|
||||
{
|
||||
ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject FirstUniqueAncestorSecurableObject { get; }
|
||||
|
||||
bool HasUniqueRoleAssignments { get; }
|
||||
|
||||
Microsoft.SharePoint.Client.RoleAssignmentCollection RoleAssignments { get; }
|
||||
|
||||
|
||||
|
||||
void ResetRoleInheritance();
|
||||
|
||||
void BreakRoleInheritance(bool copyRoleAssignments, bool clearSubscopes);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+42
-26
@@ -18,6 +18,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
string AccessRequestSiteDescription { get; }
|
||||
|
||||
string Acronym { get; }
|
||||
|
||||
Microsoft.SharePoint.Client.AlertCollection Alerts { get; }
|
||||
|
||||
bool AllowAutomaticASPXPageIndexing { get; set; }
|
||||
@@ -82,6 +84,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
string Description { get; set; }
|
||||
|
||||
string DescriptionForExistingLanguage { get; set; }
|
||||
|
||||
Microsoft.SharePoint.Client.UserResource DescriptionResource { get; }
|
||||
|
||||
System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> DescriptionTranslations { get; set; }
|
||||
@@ -132,6 +136,12 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
System.Guid Id { get; }
|
||||
|
||||
bool IsEduClass { get; }
|
||||
|
||||
bool IsEduClassProvisionChecked { get; }
|
||||
|
||||
bool IsEduClassProvisionPending { get; }
|
||||
|
||||
bool IsHomepageModernized { get; }
|
||||
|
||||
bool IsMultilingual { get; set; }
|
||||
@@ -242,6 +252,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
string Title { get; set; }
|
||||
|
||||
string TitleForExistingLanguage { get; set; }
|
||||
|
||||
Microsoft.SharePoint.Client.UserResource TitleResource { get; }
|
||||
|
||||
System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> TitleTranslations { get; set; }
|
||||
@@ -284,6 +296,32 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
void CreateDefaultAssociatedGroups(string userLogin, string userLogin2, string groupNameSeed);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink);
|
||||
|
||||
void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken);
|
||||
|
||||
void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.User GetSiteUserIncludingDeletedByPuid(string puid);
|
||||
|
||||
Microsoft.SharePoint.Client.User GetUserById(int userId);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<bool> EnsureTenantAppCatalog(string callerId);
|
||||
@@ -310,29 +348,11 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
void DeleteAnonymousLinkForObject(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink);
|
||||
Microsoft.SharePoint.Client.ListCollection GetLists(Microsoft.SharePoint.Client.GetListsParameters getListsParams);
|
||||
|
||||
void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup);
|
||||
Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken);
|
||||
|
||||
void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog);
|
||||
|
||||
Microsoft.SharePoint.Client.RecycleBinItemCollection GetRecycleBinItems(string pagingInfo, int rowLimit, bool isAscending, Microsoft.SharePoint.Client.RecycleBinOrderBy orderBy, Microsoft.SharePoint.Client.RecycleBinItemState itemState);
|
||||
|
||||
@@ -360,9 +380,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> GetSPAppContextAsStream();
|
||||
|
||||
Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage);
|
||||
|
||||
Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog);
|
||||
void Update();
|
||||
|
||||
Microsoft.SharePoint.Client.View GetViewFromUrl(string listUrl);
|
||||
|
||||
@@ -402,8 +420,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
void DeleteObject();
|
||||
|
||||
void Update();
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> PageContextInfo(bool includeODBSettings, bool emitNavigationInfo);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> PageContextCore();
|
||||
|
||||
@@ -1,33 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CSharp.SourceGenerators.Extensions;
|
||||
using CSharp.SourceGenerators.Extensions.Models;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using ProxyInterfaceSourceGenerator;
|
||||
using ProxyInterfaceSourceGeneratorTests.Source;
|
||||
using ProxyInterfaceSourceGeneratorTests.Source.PnP;
|
||||
using Xunit;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests
|
||||
namespace ProxyInterfaceSourceGeneratorTests;
|
||||
|
||||
public class PnPTests
|
||||
{
|
||||
public class PnPTests
|
||||
private bool Write = true;
|
||||
|
||||
private readonly ProxyInterfaceCodeGenerator _sut;
|
||||
|
||||
public PnPTests()
|
||||
{
|
||||
public PnPTests()
|
||||
_sut = new ProxyInterfaceCodeGenerator();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateFiles_Should_GenerateCorrectFiles()
|
||||
{
|
||||
// Arrange
|
||||
var fileNames = new[]
|
||||
{
|
||||
|
||||
}
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext.g.cs",
|
||||
|
||||
[Fact]
|
||||
public void X()
|
||||
"Microsoft.SharePoint.Client.ClientObjectProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.SecurableObjectProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.WebProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientRuntimeContextProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientContextProxy.g.cs"
|
||||
};
|
||||
|
||||
var pathClientObject = "./Source/PnP/IClientObject.cs";
|
||||
var sourceFileClientObject = new SourceFile
|
||||
{
|
||||
var webMock = new Mock<IWeb>();
|
||||
Path = pathClientObject,
|
||||
Text = File.ReadAllText(pathClientObject),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientObject)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathSec = "./Source/PnP/ISecurableObject.cs";
|
||||
var sourceFileSec = new SourceFile
|
||||
{
|
||||
Path = pathSec,
|
||||
Text = File.ReadAllText(pathSec),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(SecurableObject)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
var ccMock = new Mock<IClientContext>();
|
||||
// ccMock.SetupGet(cc => cc.Web).Returns(webMock.Object);
|
||||
var pathWeb = "./Source/PnP/IWeb.cs";
|
||||
var sourceFileWeb = new SourceFile
|
||||
{
|
||||
Path = pathWeb,
|
||||
Text = File.ReadAllText(pathWeb),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Web)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientRuntimeContext = "./Source/Pnp/IClientRuntimeContext.cs";
|
||||
var sourceFileClientRuntimeContext = new SourceFile
|
||||
{
|
||||
Path = pathClientRuntimeContext,
|
||||
Text = File.ReadAllText(pathClientRuntimeContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientRuntimeContext)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientContext = "./Source/PnP/IClientContext.cs";
|
||||
var sourceFileClientContext = new SourceFile
|
||||
{
|
||||
Path = pathClientContext,
|
||||
Text = File.ReadAllText(pathClientContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(ClientContext)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = _sut.Execute(new[]
|
||||
{
|
||||
sourceFileClientObject,
|
||||
sourceFileSec,
|
||||
sourceFileWeb,
|
||||
sourceFileClientRuntimeContext,
|
||||
sourceFileClientContext
|
||||
});
|
||||
|
||||
// Assert
|
||||
result.Valid.Should().BeTrue();
|
||||
result.Files.Should().HaveCount(fileNames.Length + 1);
|
||||
|
||||
foreach (var fileName in fileNames.Select((fileName, index) => new { fileName, index }))
|
||||
{
|
||||
var builder = result.Files[fileName.index + 1]; // +1 means skip the attribute
|
||||
builder.Path.Should().EndWith(fileName.fileName);
|
||||
|
||||
if (Write) File.WriteAllText($"../../../Destination/{fileName.fileName}", builder.Text);
|
||||
builder.Text.Should().Be(File.ReadAllText($"../../../Destination/{fileName.fileName}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void X()
|
||||
{
|
||||
var webMock = new Mock<IWeb>();
|
||||
|
||||
|
||||
var ccMock = new Mock<IClientContext>();
|
||||
// ccMock.SetupGet(cc => cc.Web).Returns(webMock.Object);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CSharp.SourceGenerators.Extensions;
|
||||
using CSharp.SourceGenerators.Extensions.Models;
|
||||
using FluentAssertions;
|
||||
@@ -180,92 +179,6 @@ namespace ProxyInterfaceSourceGeneratorTests
|
||||
proxyCode.Should().NotBeNullOrEmpty().And.Be(File.ReadAllText($"../../../Destination/{proxyClassPersonFilename}"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateFiles_ForPnP_Should_GenerateCorrectFiles()
|
||||
{
|
||||
// Arrange
|
||||
var fileNames = new[]
|
||||
{
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext.g.cs",
|
||||
|
||||
"Microsoft.SharePoint.Client.ClientObjectProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.WebProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientRuntimeContextProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientContextProxy.g.cs"
|
||||
};
|
||||
|
||||
var pathClientObject = "./Source/PnP/IClientObject.cs";
|
||||
var sourceFileClientObject = new SourceFile
|
||||
{
|
||||
Path = pathClientObject,
|
||||
Text = File.ReadAllText(pathClientObject),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientObject)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathWeb = "./Source/PnP/IWeb.cs";
|
||||
var sourceFileWeb = new SourceFile
|
||||
{
|
||||
Path = pathWeb,
|
||||
Text = File.ReadAllText(pathWeb),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Web)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientRuntimeContext = "./Source/Pnp/IClientRuntimeContext.cs";
|
||||
var sourceFileClientRuntimeContext = new SourceFile
|
||||
{
|
||||
Path = pathClientRuntimeContext,
|
||||
Text = File.ReadAllText(pathClientRuntimeContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientRuntimeContext)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientContext = "./Source/PnP/IClientContext.cs";
|
||||
var sourceFileClientContext = new SourceFile
|
||||
{
|
||||
Path = pathClientContext,
|
||||
Text = File.ReadAllText(pathClientContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(ClientContext)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = _sut.Execute(new[]
|
||||
{
|
||||
sourceFileClientObject,
|
||||
sourceFileWeb,
|
||||
sourceFileClientRuntimeContext,
|
||||
sourceFileClientContext
|
||||
});
|
||||
|
||||
// Assert
|
||||
result.Valid.Should().BeTrue();
|
||||
result.Files.Should().HaveCount(fileNames.Length + 1);
|
||||
|
||||
foreach (var fileName in fileNames.Select((fileName, index) => new { fileName, index }))
|
||||
{
|
||||
var builder = result.Files[fileName.index + 1]; // +1 means skip the attribute
|
||||
builder.Path.Should().EndWith(fileName.fileName);
|
||||
|
||||
if (Write) File.WriteAllText($"../../../Destination/{fileName.fileName}", builder.Text);
|
||||
builder.Text.Should().Be(File.ReadAllText($"../../../Destination/{fileName.fileName}"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,17 +9,17 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.17.2" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<PackageReference Include="AutoMapper" Version="11.0.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.7.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" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
@@ -30,7 +30,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CSharp.SourceGenerators.Extensions" Version="0.0.8" />
|
||||
<PackageReference Include="CSharp.SourceGenerators.Extensions" Version="0.0.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,19 +9,19 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial class ClientRuntimeContextProxy
|
||||
{
|
||||
public T CastTo2<T>(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject obj)
|
||||
where T : ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject
|
||||
//where TOriginal : Microsoft.SharePoint.Client.ClientObject
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientObject obj_ = _mapper.Map<Microsoft.SharePoint.Client.ClientObject>(obj);
|
||||
var result_366781530 = _Instance.CastTo<Microsoft.SharePoint.Client.ClientObject>(obj_);
|
||||
return _mapper.Map<T>(result_366781530);
|
||||
}
|
||||
//public T CastTo2<T>(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject obj)
|
||||
// where T : ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject
|
||||
// //where TOriginal : Microsoft.SharePoint.Client.ClientObject
|
||||
//{
|
||||
// Microsoft.SharePoint.Client.ClientObject obj_ = _mapper.Map<Microsoft.SharePoint.Client.ClientObject>(obj);
|
||||
// var result_366781530 = _Instance.CastTo<Microsoft.SharePoint.Client.ClientObject>(obj_);
|
||||
// return _mapper.Map<T>(result_366781530);
|
||||
//}
|
||||
|
||||
public void X()
|
||||
{
|
||||
var x = CastTo2<ClientObjectProxy>(new ClientObjectProxy(default));
|
||||
}
|
||||
//public void X()
|
||||
//{
|
||||
// var x = CastTo2<ClientObjectProxy>(new ClientObjectProxy(default));
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
// [ProxyInterfaceGenerator.Proxy(typeof(SecurableObject))]
|
||||
public partial interface ISecurableObject : IClientObject
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface IWeb
|
||||
public partial interface IWeb : ISecurableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user